Arrays 我想在集合中查找一个字段,还想在数组中查找一个对象id,并在子数组中推送更多对象
Mongo数据库集合是Arrays 我想在集合中查找一个字段,还想在数组中查找一个对象id,并在子数组中推送更多对象,arrays,node.js,mongodb,mongoose,mongodb-query,Arrays,Node.js,Mongodb,Mongoose,Mongodb Query,Mongo数据库集合是 { findId: xyz, mainArray:[{ andFindThisObjectId:abc, pushInThisArray:[{newValue,anotherValue}} }] } 所以这里我想在pushInThisArray字段中查找并推送更多值{newValue,anotherValue}是否无效?请为您的问题提供更多详细信息…pushInThisArray:[{newValue,ano
{
findId: xyz,
mainArray:[{
andFindThisObjectId:abc,
pushInThisArray:[{newValue,anotherValue}}
}]
}
所以这里我想在pushInThisArray字段中查找并推送更多值
{newValue,anotherValue}
是否无效?请为您的问题提供更多详细信息…pushInThisArray:[{newValue,anotherValue}}=>pushInThisArray:[{newValue,anotherValue}]
db.collection.update({
$and:[{"findId":"BL0303160"},
{"mainArray._id":ObjectId("56d7a674af6cb08406f3bf8a")}
]},
{$push:{
"mainArray.$.pushInThisArray":
{"myName":"Pratik",
"myPc":"HP"}
}});