【发布时间】:2017-09-19 07:02:47
【问题描述】:
我正在尝试将数组推送到我的集合中的文档数组中
{
"_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
【问题讨论】:
-
这里的错误信息是什么
-
Uncaught Error: After filtering out keys not in the schema, your modifier is now empty
标签: arrays mongodb meteor meteor-blaze