In the mongo documentation unsetting a field is done with $unset
. I can't quite grasp how it works, but it seems like it should be simple.
The following operation uses the $unset operator to remove the tags field:
db.books.update( { _id: 1 }, { $unset: { tags: 1 } } )
My confusion arises when setting what to unset. What is the value 1
for in the $unset
clause?