我试图推动数组文件数组我的收藏是如何在内部数组mongodb中推送数据?
{
"_id": "58eed81af6f8e3788de703f9",
"first_name": "abc",
"vehicles": {
"exhibit": "18",
"title": "Motor Velicle Information for Donald French",
"details": [
{
"year": "",
"make_model": "",
"registered_owner": "",
"license_number": "",
"date_of_purchase": "",
"purchase_price": ""
}
]
}
}
,所以我想要的是在details
推数据,我不得不尝试这样
Licensee.update({"_id":"58eed81af6f8e3788de703f9"},{
$push:{
"vehicles.details":data
}
},function(err,data){
if(!err)
{
console.log('data',data);
}
else
{
console.log('err',err);
}
});
为此我创建一个架构,我不知道是否正确
var licSchema = new SimpleSchema({
"_id":{
type:String,
label:"_id",
optional: false,
},
"vehicles.details.year": {
type: String,
label: "year",
optional: true,
},
"vehicles.details.make_model": {
type: String,
label: "make_model",
optional: true,
}
});
哪里是我的错请给我解决方案。 错误Uncaught Error: After filtering out keys not in the schema, your modifier is now empty
请告诉我错误的信息在这里 – collision
'未捕获的错误:未在该架构过滤掉键后,你的修改是现在empty' – kumbhanibhavesh