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 shell 中,我将如何删除所有出现 "id" : "1"的字段值总是不同的。我会使用 $unset 运算符吗?那会删除值和字段吗?
"id" : "1"
你是说删除所有出现的字段,对吗?如果是这样,那么它应该是这样的:
db.collection.update( { id: { $exists: true } }, // criteria { $unset: { id: 1 } }, // modifier false, // no need to upsert true // multi-update );