我有一个文档,我想使用$ pull或其他好的方法从地址列表中仅删除“ mobile_id”:“ opr_134”的设备。
{
"user_id": "eamn",
"address": [{
"address_id": 32,
"city_name": "DP 1000"
"devices": [{
"mobile_id": "opr_123",
"created_at": 2132,
"device": "company"
},{
"mobile_id": "opr_134",
"created_at": 2134,
"device": "company2"
}]
}]
}
请提出删除该设备的基本方法。
这可以完成工作:
db.triLevel.update({},{$pull:{"address.$[].devices":{"mobile_id":"opr_134"}}})
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句