A to Z
Glossary
Every concept in this sheet, plus the smaller terms it uses. Select a concept to open its card.
A
- Atlas free cluster
- MongoDB Atlas is the hosted MongoDB service.
B
- BSON and its types
- BSON is the binary format MongoDB stores and sends documents in.
C
- Cursor
- find returns a cursor, a pointer to the result that fetches documents from the server in batches as you iterate. mongosh prints the first 20; type it for more.
D
- Database and collection
- A database groups collections, and a collection groups documents, roughly like a table groups rows.
- deleteOne and deleteMany
- deleteOne removes the first matching document and deleteMany removes every match. drop removes the whole collection with its indexes.
- Document model
- Data stored as documents: self-contained records of field and value pairs that can hold nested objects and arrays, much like JSON.
F
- find and query filters
- find takes a filter document and returns every matching document; findOne returns the first match.
I
- insertOne and insertMany
- insertOne adds one document and returns its _id; insertMany adds an array of documents in one round trip.
M
- MongoDB Compass
- The free official GUI for MongoDB: browse collections, edit documents, build aggregation pipelines stage by stage, view explain plans visually and open an embedded mongosh.
- mongosh
- The MongoDB Shell: a JavaScript and Node.js based terminal program that connects to a deployment and runs queries, admin commands and scripts.
O
- ObjectId and _id
- Every document has a unique _id field, its primary key.
P
- Projection
- The second argument to find, listing the fields to return (1) or leave out (0). _id is returned unless you exclude it.
Q
- Query operators
- Operators starting with $ express conditions: $eq, $ne, $gt, $gte, $lt, $lte, $in and $nin compare values, $and, $or and $not combine conditions, $exists and $type check fields.
R
- replaceOne versus updateOne
- replaceOne swaps the whole document, apart from _id, for the one you pass. updateOne changes only the fields named by its operators and refuses a plain document.
S
- Sample dataset
- Ready-made databases, such as sample_mflix (films and comments) and sample_airbnb (listings), that Atlas loads into your cluster with one click.
- sort, skip and limit
- Cursor methods that order results by one or more fields (1 ascending, -1 descending), skip a number of documents and cap how many come back.
U
- Update operators
- updateOne and updateMany take a filter and an update document of operators: $set sets fields, $unset removes them, $inc adds to a number, $currentDate stamps the time.
- Upsert
- An update with upsert: true inserts a new document when nothing matches the filter, built from the filter and the update. $setOnInsert sets fields only on that insert.