Erase a field from every document in a collection

Hi Guys,

I want to erase a field from every document in a collection
I tried this in the meteor mongo console

meteor:PRIMARY> db.collectionName.update( { }, { $unset: { order: "" } } );
WriteResult({ "nMatched" : 1, "nUpserted" : 0, "nModified" : 0 })

It looks like it didnt work.
Any suggestions?
Thanks

Hi @markpdev!

Try to use: {multi: true} in your update function:

db.collectionName.update( { }, { $unset: { order: "" } }, {multi: true});

1 Like