1.insert
Db. Customers.insert ({ "datetest": New Date (), "inttest": +, "doubletest": 3.1415926, "stringtest": " Test ", " Booltest ": True, " arrytest ": [" a "," B "," C "], " AAA ": Undefined, " info ": {" x ": 203," Y ": 102}});
2.find
<1> $gt, $gte, $lt, $lte, $ne
--where inttest>30
Db. Customers.find ({"Inttest": {"$GT": $}})
--where inttest<30
Db. Customers.find ({"Inttest": {"$lt": $}})
--where inttest!=1
Db. Customers.find ({"Inttest": {"$ne": 1}})
--where inttest==30
Db. Customers.find ({"inttest":)
<2> "$or", "$in", "$nin"
--where firstname= "bobr"
db. Customers.find ({"FirstName": "Bobr"})
--where firstname= "bobr" or firstname= "BOBR1"
db. Customers.find ({"$or": [{"FirstName": "Bobr"}, {"FirstName": "BOBR1"}]})
--where firstname= "Bobr" and LastName = "Dillon"
db. Customers.find ({"FirstName": "Bobr", "LastName": "Dillon"})
--where FirstName in ("Bobr", "BOBR1")
Db. Customers.find ({"FirstName": {"$in": ["Bobr", "BOBR1"]}})
--where FirstName not in ("Bobr", "BOBR1") No "FirstName" will also find out
db. Customers.find ({"FirstName": {"$nin": ["Bobr", "BOBR1"]}})
<3> Regular Expressions
--firstname K Opening
Db. Customers.find ({"FirstName":/^k/})
--firstname like '%bob% '
Db. Customers.find ({"FirstName":/bob/})
<4> $where
Db. Customers.find ({"$where": "this. FirstName = = ' Kbobr ' "})
3.Update $inc (no new, added on original basis) and $set
Db. Customers.update ({"FirstName":/bob/, "$atomic": "True"},{$inc: {"Age": $}}, False, True)
Db. Customers.update ({"FirstName":/bob/, "$atomic": "True"},{$set: {"Age": $}}, False, True)
4.Remove
Db. Customers.remove ({"_id": ObjectId ("567B55A50E906E261435DAFB")}, $atomic: TRUE);
Db. Customers.remove ({"FirstName": "Kbobr"}, $atomic: TRUE);
MongoDB additions and deletions to search and change