MongoDB DBA Associate flashcards
MongoDB DBA Associate · 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.
- Majority definition
- A majority is floor(votingMembers divided by 2) plus 1. A primary must reach a majority of voting members to stay primary; without it, the node steps down and becomes a secondary.
- w:majority write concern
- The write is acknowledged only after a majority of data-bearing voting members have applied it. With w:1, an unacknowledged-by-majority write can be rolled back if the primary fails immediately after.
- electionTimeoutMillis default
- Default is 10000 milliseconds. A secondary that has not heard from the primary within this window plus a randomized jitter calls an election. Heartbeats occur every 2 seconds.
- Priority 0 member
- A replica set member with priority 0 can never become primary. It still replicates data and can serve reads. Hidden members must also have priority 0 and are excluded from read preference selection.
- Rollback files
- When a node rejoins with oplog entries the new primary never had, MongoDB saves the removed writes to rollback files in the dbPath rollback directory for manual reconciliation.
- Chunk size default
- Chunks default to 128 MB. The balancer migrates whole chunks between shards, not individual documents, and imbalance is assessed by chunk count per shard.
- Hashed versus ranged shard key
- A hashed shard key distributes writes evenly but makes range queries scatter-gather. A ranged key supports targeted range reads but risks hotspots on monotonically increasing values.
- Targeted versus scatter-gather query
- A targeted query includes the full shard key in its filter and routes to one shard. A scatter-gather query omits the shard key and is broadcast to every shard, multiplying cost.
- Zone sharding requirement
- Each zone must contain at least one shard and each shard belongs to at most one zone. Chunks migrate into a zone only when their shard key range overlaps the zone range.
- WiredTiger cache default
- The cache defaults to 50 percent of RAM minus 1 GB, or 256 MB if larger. Eviction pressure begins near 80 percent dirty and 95 percent total cache usage.
- Journal and j:true
- The WiredTiger journal provides crash durability. writeConcern j:true waits for journal acknowledgment; j:false permits loss of writes since the last journal flush, typically up to 100 ms.
- BSON document size limit
- A single BSON document is capped at 16 MB. Unbounded array growth must be split using patterns such as bucketing or outliers to stay under the limit.
- Oplog sizing
- The oplog is a capped collection in the local database sized by replication.oplogSizeMB. If a secondary falls behind the oplog window, it must perform a full resync.
- Schema validation options
- validationLevel is strict or moderate; validationAction is error or warn. Rules are set with $jsonSchema at collection creation or changed later using collMod.
- SCRAM-SHA-256
- The default authentication mechanism for clients and users. Internal replica set and sharded cluster member authentication instead uses a keyfile or x.509 certificates.
- Localhost exception
- When authorization is enabled and no users exist, a connection from localhost may create the first user. The exception closes permanently once the first user is created.
- Encryption at rest
- The WiredTiger encrypted storage engine encrypts data files using a master key held by a key provider such as KMIP or a cloud KMS; the master key is never stored in the data files.
- Client-side field level encryption
- CSFLE encrypts specified fields in the driver before transmission, so the server stores ciphertext. Queryable encryption additionally supports equality and range queries on the encrypted fields.
- authenticationRestrictions
- A per-user setting that limits authentication to specified client source IP addresses or CIDR ranges. Connections from outside the allowed ranges are rejected even with valid credentials.
- mongodump --oplog
- Captures oplog entries that occur during the dump, enabling a point-in-time consistent restore with mongorestore --oplogReplay. It is not supported against a sharded cluster through mongos.
- mongorestore --drop
- Removes each collection before restoring it. Without --drop, restored documents merge into existing collections, which can produce duplicate documents if the target was not empty.
- fsyncLock snapshot procedure
- Call db.fsyncLock() to flush and block writes, take the filesystem snapshot, then call db.fsyncUnlock(). Journaling must be enabled for the snapshot to be recoverable.
- Point-in-time recovery
- Restores a base backup then replays oplog entries up to a target timestamp. The oplog must extend back to the base backup time or the recovery target is unreachable.
- Profiler levels
- Level 0 is off, level 1 records operations slower than slowms, and level 2 records all operations. Profiling writes to the capped system.profile collection and adds overhead.
- explain executionStats fields
- totalKeysExamined, totalDocsExamined, and nReturned quantify work. A well-targeted index scan keeps totalDocsExamined close to nReturned, while a large gap signals poor selectivity.
- COLLSCAN stage
- A collection scan in explain output, meaning no index served the query. It appears as stage COLLSCAN and scales with collection size, unlike an IXSCAN which bounds work by key range.
- Replication lag measurement
- Compare optimeDate between primary and secondaries in rs.status(). Persistent lag with a small oplog risks the secondary falling off the oplog window and requiring a full resync.
- mongotop and mongostat
- mongotop reports per-collection read and write time; mongostat reports per-second opcounters, connections, and queue depths. Both sample point-in-time and are best used over intervals.
- Rolling upgrade sequence
- Upgrade secondaries one at a time, step down the primary so another member takes over, upgrade the former primary, then raise featureCompatibilityVersion as the final step.
- featureCompatibilityVersion
- FCV gates which features are active and which data formats are permitted. It stays at the previous value after a binary upgrade until setFeatureCompatibilityVersion is run explicitly.
- Initial sync
- A new replica set member copies all data from a sync source and then applies oplog entries. Large datasets make this slow, so seeding from a filesystem snapshot is often faster.
- Ops Manager automation agent
- An agent installed on every managed host that performs deployments, restarts, and backup coordination. The backup daemon stores snapshots in a blockstore or object storage bucket.