Update

Update all document

db.getCollection('a_yirmi_b_lambda').updateMany({}, {$set: { 'status':false}})

update_many

user_id : 1 olan tüm email_status field lerini ok yapar

db.members.updateMany(
   { "user_id" : 1 },
   {
     $set: { "email_status" : "ok" },
   }
)

user_id: 1 ve status durumu soft_bounce olanların tümünün durumunu status=active yapar

db.getCollection('members').updateMany(
   { "user_id" : 1, "status" : "soft_bounce" },
   {
     $set: { "status" : "active" },
   }
   )

239 ve içinde hotmail.com geçen tüm dataların is_active durumlarını false yapar

db.getCollection('members').updateMany(
{ 
    "user_id" : 239,
    'email' : /@hotmail.com/ 
},
 {
  '$set': { "is_active" : false },
   }
    
 )

find and modify

db.getCollection('members').findAndModify({
    query: { "liste" : [ "papatya" ]  },
    update: { $set: { "liste" : [ "papatya değişti" ] } }
})

Last updated