【发布时间】:2017-08-23 01:53:58
【问题描述】:
我是一个 mongoDB 菜鸟,我正在为查询而苦苦挣扎。假设我有以下结构:
{
"id": "1",
"type": 2,
"shops": ["1000","2000","3000"]
},
{
"id": "2",
"type": 2,
"shops": ["1000","4000","5000"]
}
如何删除每个等于 1000 的商店,以便生成的数据库记录为:
{
"id": "1",
"type": 2,
"shops": ["2000","3000"]
},
{
"id": "2",
"type": 2,
"shops": ["4000","5000"]
}
提前非常感谢!
【问题讨论】:
-
更新的 json
"shops": [ 0: 4000 1: 5000 ]对我来说似乎不正确。列表中应该有一些对象来包含这些键和值。