Mongoose set default as empty object

前端 未结 2 1561
执笔经年
执笔经年 2020-12-29 02:04

I am trying to set the star_info attribute as an object type(Mixed Schema) and setting it\'s default value as an empty object using

star_info:          


        
2条回答
  •  悲&欢浪女
    2020-12-29 02:27

    If you don't mind empty objects being omitted from the database, but you want them in your JSON, just use obj.toJSON({minimize: false})

提交回复
热议问题