我在一个集合中添加了一个嵌入式对象。对象如下所示
{ "_id" : ObjectId("506d3046a4e89e856eace0cc"),
"name": "new"
"menuList":[{
"name":"dssdfDS",
"des":"dsfsdf",
"_id" : ObjectId("506d3046a4d89e856eace0cc")
}]
}
我创建了 BasicDBObject 查询以将“menuList”推送到“name”:“new”,我已经成功完成了,现在我想将 menuList1 附加到 menuList。
{ "_id" : ObjectId("506d3046a4e89e856eace0cc"),
"name": "new"
"menuList":[{
"name":"dssdfDS",
"des":"dsfsdf",
"_id" : ObjectId("506d3046a4d89e856eace0cc")
"menuList1":[{
"name":"dssdfDS",
"des":"dsfsdf",
"_id" : ObjectId("506d3046a4d89e856eace0cc")
}]
}]
}
如何通过在menuList中推送menuList1来进行BasicDBObject 查询以更新menuList?