1
我有以下對象如何刪除mongodb中的引用?
{
"_id" : ObjectId("4b8699aa3b97dc29dd000000"),
"name" : "test",
"email" : "test",
"url" : "test",
"items" : [
{
"$ref" : "item",
"$id" : ObjectId("4b866a043b97dc22a9000001")
}
]}
我怎樣才能刪除項目的參考?我有參考的目標? 我嘗試了以下,它適用於普通列表項,但不適用於參考。
db.foo.update(foo, {$pull: {'items': {'$id': ObjectId("4b866a043b97dc22a9000001") } } })