0

我在我的 mongodb 中的一个集合中以这种格式获得了记录。

{ "_id" : 10, "item" : "AA7 Jan 15 2016 5.00 Call", "qty" : 20, "symbol" : "SYP" }
{ "_id" : 11, "item" : "AA7 Jan 16 2016 6.00 Call", "qty" : 20, "symbol" : "SYP" }
{ "_id" : 12, "item" : "AA7 Jan 17 2016 7.00 Call", "qty" : 20, "symbol" : "SYP" }
{ "_id" : 13, "item" : "AA7 Jan 18 2016 8.00 Call", "qty" : 20, "symbol" : "SYP" }
{ "_id" : 14, "item" : "AA7 Jan 19 2016 9.00 Call", "qty" : 20, "symbol" : "SYP" }
{ "_id" : 15, "item" : "AA7 Jan 20 2016 0.00 Call", "qty" : 20, "symbol" : "SYP" }

我需要一次从所有记录中删除名为“item”的属性中的数字 7。

这样整体输出将如下所示

{ "_id" : 10, "item" : "AA Jan 15 2016 5.00 Call", "qty" : 20, "symbol" : "SYP" }
{ "_id" : 11, "item" : "AA Jan 16 2016 6.00 Call", "qty" : 20, "symbol" : "SYP" }
{ "_id" : 12, "item" : "AA Jan 17 2016 7.00 Call", "qty" : 20, "symbol" : "SYP" }
{ "_id" : 13, "item" : "AA Jan 18 2016 8.00 Call", "qty" : 20, "symbol" : "SYP" }
{ "_id" : 14, "item" : "AA Jan 19 2016 9.00 Call", "qty" : 20, "symbol" : "SYP" }
{ "_id" : 15, "item" : "AA Jan 20 2016 0.00 Call", "qty" : 20, "symbol" : "SYP" }

这是更新命令,请让我知道在集合内发出什么??

db.mycollection.update(
{
 "symbol" : "SYP"
},
{
    "$set": {

    }
}, false , true
)
4

0 回答 0