Preview:
INSERTING ONE AND MANY
db.places.insertOne({})
db.places.insertMany({})

UPDATING - ONE AND MANY
db.places.updateOne({"country": "India"}, {$set: {"continent": "Europe"}})
db.places.updateMany({"country": "India"}, {$set: {"flag": "Updated Flag"}})

DELETING
db.places.deleteOne({"continent": "Africa"})
db.places.deleteMany({"continent": "Africa"})
db.places.findAndDelete({})

FINDING
db.students.find({"name":"Andy"})
db.students.find({"name":"Mike"})

FINDING using $OR and $IN
this will return entries that have hobbies of baseball OR MAC and Linux users
db.students.find( { $or: [ { "hobbies": { $in: ["Baseball"]}}. { "os" { $in: ["Mac", "Lin"]}}]})

also compatible with SOME regex expressions

SORTING:
db.animals.find().sort({weight: -1}); <== this is descending, a positive value is ascending



downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter