Invalid value for schema Array path

前端 未结 2 1992
野趣味
野趣味 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]
    });
    
    0 讨论(0)
  • 2021-02-04 16:13

    run

    npm install mongoose@3.8.5

    for a quick fix

    0 讨论(0)
提交回复
热议问题