const CommentSchema = new mongoose.Schema({
username: {
type: String,
required: true,
},
detail: {
type: String,
required: true,
},
responses: [CommentSchema]
})
const PostSchema = new mongoose.Schema({
author: {
type: String,
required: true,
},
title: {
type: String,
required: true
},
comments: [CommentSchema]
})
我不断收到 CommentSchema 不存在的引用错误。如何使用 mongoose 嵌套模式?我认为错误是因为在 const commentschema 中调用了 commentSchema。我以前见过这个,所以我不知道它是否可能
www说
吃鸡游戏
至尊宝的传说
随时随地看视频慕课网APP
相关分类