Invalid value for schema Array path

前端 未结 2 2039
野趣味
野趣味 2021-02-04 15:54

I am trying to build comment model contains: Reply and CommentThread. CommentThread contains Reply, and Reply can recurse itself.

/models/comment.js :

va         


        
2条回答
  •  耶瑟儿~
    2021-02-04 16:05

    https://searchcode.com/codesearch/view/6134527/

    see the example above, you need to do something like

    var replySchema = new Schema();
    replyschema.add({
      username: String,
      timestamp: { type: Date, default: Date.now },
      body: String,
      replies: [replySchema]
    });
    

提交回复
热议问题