Mongoose Schema hasn't been registered for model

前端 未结 17 868
猫巷女王i
猫巷女王i 2020-11-27 15:00

I\'m learning the mean stack and when I try to start the server using

npm start

I get an exception saying that:

schema has         


        
17条回答
  •  暗喜
    暗喜 (楼主)
    2020-11-27 15:58

    Refer the same name that you refer in model name while creating new model.

    For example: if I have mongoose model like:

    var Post = mongoose.model("post",postSchema);
    

    Then I have to refer to posts collection via writing ref:"post".

提交回复
热议问题