Databases & Collections
In MongoDB, databases contain collections (similar to tables), and collections contain documents (similar to rows).
Show Databases & Switch
Create & Drop Collections
CRUD โ Create
Insert documents into a collection with insertOne() or insertMany().
Insert One Document
Insert Many Documents
CRUD โ Read
Query documents with find(), findOne(), and filtering options.
Find All & Find One
Projection (Select Specific Fields)
Limit, Skip, Sort, Count
CRUD โ Update
Modify documents using updateOne(), updateMany() with operators like $set, $inc, $push, etc.
Update One Document
Update Operators
Array Operators
Replace One Document
CRUD โ Delete
Remove documents with deleteOne() or deleteMany().
Delete Operations
WARNING: deleteMany({}) deletes all documents. Always test your filter first with find() before deleting.
Query Operators
Use comparison and logical operators to build complex queries.
Comparison Operators
Logical Operators
Field Operators
Array Operators
Query and match array fields within documents.
Array Matching
Aggregation Pipeline
Process data through multiple stages for advanced analytics.