MongoDB Cheat Sheet (2)
MongoDB Cheat Sheet (2)
1. Basic Commands
-----------------
2. CRUD Operations
------------------
Create / Insert
---------------
Read / Query
------------
Update
------
db.users.updateOne(
{ name: "Alice" },
{ $set: { age: 26 } }
db.users.updateMany(
{ age: { $lt: 18 } },
Delete
------
3. Collection Operations
------------------------
4. Indexing
-----------
5. Aggregation Example
----------------------
db.orders.aggregate([
])
6. Miscellaneous
----------------
db.stats() // DB statistics