Not
  • Merhaba Dünya
  • Python
    • Sanal Ortam
    • Json
    • Cheat Sheet
    • Search
  • Javascript
    • Node
    • Vue
  • PostgreSQL
    • Install
    • Start Stop
    • Create Db
    • Backup Restore
    • Insert, Update, Delete
    • Kısa Yollar
  • Docker
    • Cheat Sheet
    • Problem
    • Komutlar
    • Örnek Konfigürasyon
    • Volume
  • Php, MySQL
  • Amazon AWS
  • Git
  • Celery
  • Mongo
    • Delete
    • Update
    • Amazon DocumentDB
  • Linux
  • Avesome
  • Bazı Bilgiler
  • Django
    • Models
    • Cheat Sheet
    • Snippets
  • Redis
  • Visual Studio Code
Powered by GitBook
On this page
  • Update all document
  • update_many
  • find and modify
  1. Mongo

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" ] } }
})
PreviousDeleteNextAmazon DocumentDB

Last updated 4 years ago