Thuta Learning
ရှာဖွေရန်
IntermediateData & Databasesintermediate

Update Operators

စိတ်လျှော့ပါ။ ဒီခန်းကို စာအုပ်လိုမဟုတ်ဘဲ စကားပြောသလိုပဲ၊ နားလည်လွယ်အောင် ရှင်းပါမယ်။

Update လုပ်ရာတွင် အသုံးများသော operators များ:

$set: field ၏တန်ဖိုးကို အသစ်သတ်မှတ်ရန်/ထပ်တိုးရန်

$inc: number field ၏တန်ဖိုးကို တိုး/လျှော့ ရန်

$unset: field တစ်ခုကို ဖယ်ရှားရန်

$push: array field ထဲသို့ item အသစ်ထည့်ရန်

javascript
// Increment the quantity of "journal" by 5
db.inventory.updateOne(
   { item: "journal" },
   { $inc: { qty: 5 } }
)
You should see
("journal" ၏ qty မှာ 25 မှ 30 သို့ တိုးသွားမည်)
Update Operators | Thuta Learning