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

后端 未结 7 1562
日久生厌
日久生厌 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条回答
  •  無奈伤痛
    2020-12-09 15:39

    I got a similar issue using mongoose 5.7.0+ using double nested schema.

    Except it wasn't related to the keyword type but a mongoose validation bug.

    https://github.com/Automattic/mongoose/issues/8472

    Temporary workaround: Use Schema.Types.Mixed for the subschema

提交回复
热议问题