Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

mongodb update many

db.vendors.updateMany(
    {isPartner:undefined}, 
    { $set: {  isPartner: false}}
)

in this example it loops over all documents, if isPartner exists it keeps it the same,
else it will be set to false
 
PREVIOUS NEXT
Tagged: #mongodb #update
ADD COMMENT
Topic
Name
4+6 =