MongoDB Associate Developer flashcards
MongoDB Associate Developer · Build recall with a focused review session.
32 cards. Read the term and the definition here. The deck at the top of this page is optional.
- ObjectId structure
- A 12-byte BSON type made of a 4-byte Unix timestamp, a 5-byte per-process random value, and a 3-byte incrementing counter, producing roughly time-ordered unique identifiers.
- WiredTiger storage engine
- MongoDB's default storage engine since version 3.0; it provides document-level concurrency control, checkpoints, journaling, and optional snappy or zstd compression for collections and indexes.
- Replica set primary
- The single replica-set member that accepts writes. Secondaries replicate its oplog and may serve reads depending on read preference, and an election chooses a new primary if it fails.
- write concern majority
- A write concern where the write is acknowledged only after a majority of voting replica-set members have applied it, protecting acknowledged writes from rollback during failover.
- insertMany ordered:false
- Option that makes a bulk insert continue processing remaining documents after an error, returning an array of write errors instead of stopping at the first failure.
- replaceOne semantics
- Replaces the entire matched document with the supplied replacement while preserving the existing _id; any field absent from the replacement is removed from the document.
- upsert option
- When an update or replace finds no matching document, upsert:true inserts a new document built from equality conditions in the filter combined with the update operators.
- $addToSet versus $push
- Both add values to an array, but $push always appends while $addToSet adds a value only if it is not already present, giving set-like deduplication.
- Compound index prefix rule
- A compound index supports queries on any leading subset of its fields in order; a query that skips the first indexed field cannot use the index efficiently.
- Covered query
- A query whose filter and projection use only indexed fields, so the server answers entirely from the index and explain shows no document fetch stage.
- Multikey index
- An index on a field that holds an array; MongoDB writes one index entry per array element, and a compound index may include at most one array field.
- TTL index
- A single-field index on a date field with expireAfterSeconds; a background thread deletes documents once the indexed date is older than the time to live.
- $lookup stage
- Aggregation stage that performs a left outer join with another collection, matching localField to foreignField or using a sub-pipeline with let variables.
- preserveNullAndEmptyArrays
- An option of $unwind that keeps documents whose array field is missing, null, or empty instead of dropping those documents from the pipeline output.
- $group accumulators
- Operators used inside $group, such as $sum, $avg, $min, $max, $push, $addToSet, $first, and $last, which compute values across documents sharing the same _id key.
- allowDiskUse
- An aggregation option that lets stages exceeding the 100 MB per-stage memory limit spill intermediate results to temporary files on disk instead of returning an error.
- Embedding versus referencing
- Embed related data when it is read together and bounded in size; reference by _id when the relationship is large, unbounded, or shared across many parent documents.
- Bucket pattern
- A modeling approach that groups many small, time-ordered events into a bounded number of documents, avoiding unbounded arrays and keeping index size small.
- Unbounded array risk
- Arrays that grow without limit can approach the 16 MB document limit, inflate index size, and force expensive full-document rewrites on every update.
- Extended reference pattern
- Copies a few frequently needed fields from a referenced document into the parent to avoid joins, accepting duplicated data that must be resynchronized periodically.
- withTransaction helper
- A driver helper that runs a callback inside a transaction and automatically retries on TransientTransactionError and UnknownTransactionCommitResult, simplifying correct transaction code.
- Snapshot read concern
- The read concern used in multi-document transactions; it returns data as of a single point in time so every read in the transaction sees a consistent snapshot.
- Single-document atomicity
- Every write to an individual document is atomic in MongoDB even without transactions, which is why embedded data models often avoid multi-document transactions entirely.
- transactionLifetimeLimitSeconds
- Server parameter defaulting to 60 seconds that aborts transactions running too long; long transactions also hold snapshots and prevent oplog truncation.
- MongoClient singleton
- A thread-safe driver object that owns a connection pool; applications create one per process and reuse it across requests rather than connecting per request.
- mongodb+srv connection string
- A URI scheme that resolves a DNS SRV record to discover replica-set hosts and default options, commonly used for Atlas cluster connections.
- maxPoolSize
- Connection pool setting that caps connections per server; the driver default is 100, and pools should be sized against the server's connection limits.
- Duplicate key error 11000
- Error code returned when a write violates a unique index; drivers surface it as a write error that applications must handle rather than blindly retry.
- mongosh
- The modern MongoDB shell, a Node.js-based REPL that supports JavaScript with async APIs, EJSON output, startup scripts, and loading files through load().
- Compass schema analysis
- A feature of the MongoDB Compass GUI that samples documents to display field types, value distributions, and index usage for schema and query design.
- Atlas Search $search
- An aggregation stage available in Atlas that runs full-text Lucene-based queries against an Atlas Search index using operators such as text, autocomplete, and compound.
- mongodump and mongorestore
- Database Tools utilities that produce and restore a binary BSON export of a database; used for backups and migrations, distinct from JSON-based mongoexport and mongoimport.