MongoDB Unset

Unset a field from Documents

Sample of document, and you want to unset the field “affLink”.


{ "_id" : 1,

"domain" : "",

"affLink" : "abc" }

Interested in mastering Mongo DB Training?

Enroll now for FREE demo on Mongo DB Training.

To unset a field from all documents, set {multi: true}, else only the field of the first matched document will be removed.

db.domain.update({},{$unset: {affLink:1}},{multi: true});



{ "_id" : 1, "domain" : "" }

For indepth understanding click on