Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
mongo シェルでは、フィールドの値の出現をすべて削除する方法 "id" : "1"は常に異なります。$unset 演算子を使用しますか? それは値とフィールドを削除しますか?
"id" : "1"
フィールドのすべてのオカレンスを削除すると言っていますよね? もしそうなら、それは次のようになるはずです:
db.collection.update( { id: { $exists: true } }, // criteria { $unset: { id: 1 } }, // modifier false, // no need to upsert true // multi-update );