是否可以在猫鼬模式中为具有Schema.Types.ObjectId
类型的字段设置默认值?
我的问题很简单:
status: {
type: Schema.Types.ObjectId,
ref: 'type',
category: 'languageStatus'
},
我想使用type
: pending
,但它不是字符串,而是an object
在type
集合中。有没有办法通过模式来做到这一点,或者我需要手动管理它?
是否可以在猫鼬模式中为具有Schema.Types.ObjectId
类型的字段设置默认值?
我的问题很简单:
status: {
type: Schema.Types.ObjectId,
ref: 'type',
category: 'languageStatus'
},
我想使用type
: pending
,但它不是字符串,而是an object
在type
集合中。有没有办法通过模式来做到这一点,或者我需要手动管理它?