猫鼬模式包含自身

时间:2018-08-07 01:40:16

标签: mongoose recurring

我想对评论层次进行评论。 并找到了一个好的解决方案。 https://www.makeschool.com/online-courses/tutorials/reddit-clone-in-node-js/comments-on-comments-part-deux

当我创建评论模型时,

const CommentSchema = new Schema({
  content            : { type: String, required: true },
  comments           : [CommentSchema]
});

发生类型错误。 (我有猫鼬v5.2.6) ->评论:[CommentSchema]

还有另一种包含自身的方式吗?

非常感谢。

0 个答案:

没有答案