当我尝试在Node js应用中创建新Case时,我收到每个字段的验证错误:
due_date_of_payment
due_amount
due_amount_currency
猫鼬认为他们是空的,是有原因的
这是我的案例模型架构
module.exports = new Schema({
...
invoices: [
{
due_date_of_payment: {
type: Date,
required: true
},
due_amount: {
type: String,
required: true
},
due_amount_currency: {
type: String,
required: true,
enum: ['EUR'],
},
}
],
...
但是,如果我将发票作为付款对象,其键为Due_date_of_payment,Due_amount和Due_amount_currency
并将模型中的发票更改为对象而不是数组,一切正常,新文档返回到前端