Mongoose, CastError: Cast to Array failed for value when trying to save a model that contains a model

后端 未结 7 1589
日久生厌
日久生厌 2020-12-09 14:52

I am trying to create the model for my mongodb database using mongoose. This is what I am trying to do:

var Class = mongoose.model(\'Class\', {className: St         


        
7条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-09 15:25

    Explicitly defining the type rule on a property called type is allowed and won't throw an error. like this:

    type: {type: String}
    

提交回复
热议问题