0
當我試圖保存在數據庫中的數據,它給禁消息貓鼬驗證給「CastError:鑄鐵未定義的失敗值」
CastError:鑄鐵未定義的失敗值
[
{"product":{"supplierId":{"undefined":"rfytr"}}},
{"product":{"supplierId":{"$empty":"rfytr"}}}
] at path "condition"
我無法弄清楚問題所在。 我的架構是
var mongoose = require('mongoose'),
validator = require('mongoose-validators'),
Schema = mongoose.Schema;
var RuleSchema = new Schema({
description: {
type: String,
validate: [validator.isLength(1, 50)]
},
status: {
type: String,
enum: ['live', 'active', 'paused', 'inactive', 'unfinished']
},
/**
condition. It can only contain object.
*/
condition: [{
type: Object
}]
});