SQL | Mongodb |
---|---|
INSERT INTO collection(username,email,age) VALUES('johndoe','johndoe_at_example.com',28) | db.collection.insert({username:'johndoe','johndoe_at_example.com'}) |
UPDATE collection SET username = 'jackdoe' WHERE email = 'johndoe_at_example.com'' | db.collection.update({email:'johndoe_at_example.com''},{$set{username:'jackdoe'}}) |
SELECT COUNT(*) as count FROM collection WHERE age >= 18 | db.collection.count({age:{$gte:18}}) or db.collection.aggregate([{$match:{age:{$gte:18}}},{$count:"count"}]) |
Last active
October 17, 2018 12:47
-
-
Save Mparaiso/2b639e3234a3265c4221e861fc735b2a to your computer and use it in GitHub Desktop.
SQL to mongodb command cheat sheet: How to translate SQL into mongodb command?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment