【发布时间】:2014-03-23 15:53:58
【问题描述】:
我目前正在开发一个我们正在使用 mongodb 的应用程序,我是新手,在复杂的更新方面遇到了很多挑战
这是我们的收货单:
{
"_id" : ObjectId(),
"company" : String,
"employee" : String,
"office" : String,
"status" : String,
"subOrders" : [
{
"products" : [
{
"productId" : ObjectId(),
"name" : String,
"price" : String,
"status" : String
}
],
"tax" : Int,
"subTotal" : Int,
"total" : "Int,
"status" : String,
"orderNote" : String
}
]
}
我们需要提交如下更新
update the subOrders.products.status to something ( for example : delivered )
在哪里
company = "x company" and office = "y office" and subOrders.products.productId = "z id"
谁能给我们一个干净的代码来处理这个查询
请不要提供指向博客或网站的链接,除非它们针对的是非常相似的问题
提前致谢
【问题讨论】: