我尝试搜索Google,但答案无关紧要,我想问的是如何在Postman中发布枚举数据。
我目前在带有Express框架的Node js中工作,我尝试使用枚举对多个引用进行猫鼬建模
但是,说实话,当碰到端点时,我总是失败
这是我的代码
fieldBookedIDs: {
type: Schema.Types.ObjectId,
required: true,
// Instead of a hardcoded model name in `ref`, `refPath` means Mongoose
// will look at the `onModel` property to find the right model.
refPath: 'fieldBookedID'
},
fieldBookedID: {
type: String,
required: true,
enum: ['Player', 'Community']
},
{
结果是
"error": {
"message": "field validation failed: fieldBookedIDs: Cast to ObjectID failed for value \"{ fieldBookedID: [ '12234553fscdf', '15454asdasd' ] }\" at path \"fieldBookedIDs\", fieldBookedID: Path `fieldBookedID` is required."
}
}
感谢您的帮助:)