我有一个包含以下键数组对的文档:
"home" : [
"Kevin Garnett",
"Paul Pierce",
"Rajon Rondo",
"Brandon Bass",
" 5 sec inbound",
"Kevin Seraphin"
]
我想" 5 sec inbound"
从数组中删除元素并使用以下命令(在 MongoDB shell 中):
>coll.update({},{"$pull":{"home":" 5 sec inbound"}})
正如查询所验证的那样,这不起作用:
>coll.findOne({"home":/5 sec inbound/})
"home" : [
"Kevin Garnett",
"Paul Pierce",
"Rajon Rondo",
"Brandon Bass",
" 5 sec inbound",
"Kevin Seraphin"
]
任何帮助将不胜感激!