Remove:
Remove the wand with the from our name
"Doom Bringer"
wands
collection.
Db.wands.remove ({name: "Doom bringer"})>> writeresult ({' ngremoved ': 1})
When we removed "Doom Bringer"
the wand, we noticed that it had a power "Death"
of, and we don ' t want any wands as that in our data Base. To is safe, let's remove any wands containing the in their powers
.
Db.wands.remove ({name: "Doom bringer", Powers: "Death"})
Update:
Write the command to update the wand with a in and set the to name
"Devotion Shift"
price
5.99
.
Db.wands.update ({name: "Devotion Shift"},{"$set": {price:5.99}});
Update all the document: "multi"
Increase level_required by 2, apply to all of the documents match {powers: "Fire"}:
db.wands.update ( "Fire"}, {"$inc": {level_required:2}}, {true })
Create New Document If there is no existing one: "upsert"
db.logs.update ( "Dream Bender"}, {"$inc": {count:1}}, {True })
[MongoDB] Remove, update, create document