logo
Search
showing results for - "mongodb add or update document fields only if they don 27t exist"
Theo
24 Sep 2017
1db.foo.update({'field': {$exists : false}}, {$set: {'field': ''}})
2// for multiple update do this
3db.foo.update({'field': {$exists : false}}, {$set: {'field': ''}}, false, true)
similar questions
add property to all documents mongomongodb update a data in databasemongodb add 1 to fieldmongodb rename propertymongodb add new fieldupdate field name in mongodb
queries leading to this page
mongodb add field to all document if not existmongodb update add new field if not existmongodb update field add if doesn 27t existsmongodb 24set if filed doesnt existfield not exists mongodbif field not exists insert mongodbmongo update field add if doesn 27t existsmongodb set field if not existsmongodb update field if not existsmongodb add field if not existmongodb add new field if not existmongodb add or update document fields only if they don 27t existmongodb add or update document fields only if they don 27t exist
privacy policyterms of useinstagram
Crafted with  ♥  for everyone

sign in to continue
your answer for
you will get a confirmation link on this - you will have to click that for successful submission of your answer. we require this to keep the website free of spam, bots and unhelpful content
please ensure to add code which is syntactically corrent and executes properly
sign in to continue
ask question on maxinterview
you will get a confirmation link on this - you will have to click that for successful submission of your question. we require this to keep the website free of spam, bots and unhelpful content
please be clear, to the point and respectful
sign in to continue