MongoDB Exercises with Answers
Practise MongoDB with 143 interactive exercises: multiple choice, fill-in-the-blank, output prediction and debugging. Every exercise gives instant feedback, a hint and the full solution.
Topic All topics Introduction Insert Find & Queries Query Operators Projection & Sorting Update Delete Data Types Arrays Embedded Documents Indexes Aggregation Basics Aggregation Stages $lookup Joins Schema Design Validation Text Search Transactions Node.js Driver Mongoose Performance & explain Replication Sharding Security & Users Backup & Monitoring Null and Missing Fields Cursor Iteration and Cleanup Compound Keyset Pagination Bulk Writes and Partial Errors Optimistic Concurrency Control Window Functions Dates and Timezone Buckets Densify and Fill Read-Only Collection Views Materialized Summary Refresh Change Streams and Resume Tokens Time Series Collections GridFS File Streaming Geospatial Queries Multikey Index Limits Collation and Index Matching Wildcard Indexes Driver Pools and Timeouts
All types Fill in the blanks Multiple choice Predict the output
Any level Easy Medium Hard
Score 0 / 143
Complete the command that switches to the shop database.
shop
use switches the current database.
Check answer Show solution
What is a collection in MongoDB most similar to in SQL?
A A row B A column C A table D A database server
Collections hold documents, as tables hold rows.
Show answer
What happens if you insert a document without an _id?
A The insert fails B _id is set to 0 C The document has no id D MongoDB generates a unique ObjectId for it
Every document must have a unique _id.
Show answer
A collection has 3 documents. What does this return?
db. items . insertOne ( { name: 'Pen' } )
db. items . countDocuments ( )
A 1 B 4 C 3 D 0
The new document brings the total to 4.
Show answer
Can two documents in the same collection have different fields?
A Yes, collections have flexible schemas unless validation rules are added B No, never C Only if they have the same _id D Only in Atlas
Schema validation can enforce rules when you need them.
Show answer
Complete the command that adds several documents at once.
db. tags . ( [ { name: 'new' } , { name: 'sale' } ] )
insertMany takes an array of documents.
Check answer Show solution
What does insertOne return when it succeeds?
A An acknowledgement with the insertedId B The whole document C true only D The number of documents in the collection
{ acknowledged: true, insertedId: ... }.
Show answer
What error does inserting a duplicate _id cause?
A 404 Not Found B A warning only C It replaces the old document D E11000 duplicate key error
Unique indexes raise the same error.
Show answer
Predict the outputmedium Insert How many documents are saved by this ordered insert if B already exists?
db. c . insertMany ( [ { _id: 'A' } , { _id: 'B' } , { _id: 'C' } ] )
A 0 B 2 C 1 D 3
A is saved, B fails, and the ordered insert stops before C.
Show answer
What does { ordered: false } change in insertMany?
A The documents are sorted B Errors are ignored silently C Only one document is inserted D MongoDB attempts every document and reports all failures at the end
Unordered inserts can also run faster.
Show answer
Complete the query to find the single user with id 7.
db. users . ( { _id: 7 } )
findOne returns one document or null.
Check answer Show solution
A An array always B The first document C A cursor over the matching documents D A count
Use toArray() or a loop to read it in code.
Show answer
Using the products collection, how many documents does this match?
db. products . find ( { category: 'kitchen' , 'stock.warehouse' : 'Leeds' } )
A 1 B 2 C 3 D 0
The Mug and the Kettle are both kitchen items in Leeds.
Show answer
What does { tags: 'sale' } match when tags is an array?
A Documents whose tags array is exactly ['sale'] B Nothing, arrays need special operators C Documents whose tags array contains 'sale' D Documents with a field called sale
A single value matches any element.
Show answer
What does { discount: null } match?
A Only documents where discount is null B Documents where discount is 0 C Nothing D Documents where discount is null or the field is missing
Use $exists to tell missing and null apart.
Show answer
Complete the filter to find products cheaper than 10.
db. products . find ( { price: { : 10 } } )
$lt means less than.
Check answer Show solution
Which operator matches any value in a list?
A $all B $in C $or D $any
$nin matches none of the values.
Show answer
How many products does this match in the products collection?
db. products . countDocuments ( { category: { $in: [ 'kitchen' , 'office' ] } } )
A 2 B 3 C 4 D 5
Mug, Kettle and Pen.
Show answer
How do you find documents that don't have a phone field?
A { phone: null } B { phone: { $ne: true } } C { $not: 'phone' } D { phone: { $exists: false } }
null would also match documents where phone is null.
Show answer
When do you need $elemMatch?
A For every array query B Only for arrays of numbers C When several conditions must all apply to the same array element D To count elements
Separate dot-notation conditions can match different elements.
Show answer
Complete the sort so the newest orders come first.
db. orders . find ( ) . sort ( { createdAt: } )
-1 sorts in descending order.
Check answer Show solution
What does the projection { name: 1, _id: 0 } return?
A Everything except name B Only the name field C Name and _id D Nothing
_id: 0 removes the id that would otherwise be included.
Show answer
With 45 matching documents and 20 per page, how many documents does page 3 return?
db. c . find ( ) . sort ( { _id: 1 } ) . skip ( 40 ) . limit ( 20 )
A 20 B 0 C 45 D 5
Only 5 documents remain after skipping 40.
Show answer
Why add _id to a sort on price?
A It's required B It makes the sort descending C It gives a stable order for equal prices, so paging doesn't repeat or skip items D It hides _id
_id is unique, so it breaks ties.
Show answer
Why does range-based paging stay fast when skip doesn't?
A skip must walk past every skipped document, while a range filter jumps straight to the next ones using an index B It uses less memory on the client C skip doesn't use indexes at all D Range paging returns fewer fields
Deep pages with skip get steadily slower.
Show answer
Complete the update to add 1 to the views count.
db. articles . updateOne ( { _id: 9 } , { : { views: 1 } } )
$inc adds to a numeric field.
Check answer Show solution
What's the difference between updateOne and updateMany?
A updateOne changes the first matching document; updateMany changes all matches B updateOne is faster C updateMany needs upsert D There's none
Check the filter carefully before using updateMany.
Show answer
Predict the outputmedium Update A product has price 10. What are matchedCount and modifiedCount after this?
db. products . updateOne ( { _id: 7 } , { $set: { price: 10 } } )
A 1 and 1 B 0 and 0 C 1 and 0 D 0 and 1
It matched, but nothing changed.
Show answer
What does { upsert: true } do?
A Updates every document B Returns the updated document C Undoes the update D Inserts a new document if nothing matches the filter
$setOnInsert sets fields only on that insert.
Show answer
How can you stop stock going below zero when two customers buy at once?
A Read the stock, check it in code, then write it B Use replaceOne C Put the condition in the filter and use $inc, so the check and change happen atomically D Use updateMany
Single-document updates are atomic.
Show answer
Complete the command that removes every document with status "expired".
db. coupons . ( { status: 'expired' } )
deleteMany removes all matching documents.
Check answer Show solution
What does deleteOne report when nothing matches?
A deletedCount: 0 B An error C null D It deletes the first document anyway
No match isn't an error.
Show answer
What does deleteMany({}) do?
A Nothing B Drops the database C Removes every document but keeps the collection and its indexes D Removes the collection
drop() removes the collection itself.
Show answer
Why does findOneAndDelete suit a job queue?
A It's faster than find B It removes and returns one job atomically, so two workers never take the same job C It sorts jobs automatically D It retries failed jobs
Pass a sort to take the oldest job first.
Show answer
What does a TTL index with expireAfterSeconds: 3600 on lastSeen do?
A Automatically deletes documents whose lastSeen is more than an hour in the past B Deletes the index after an hour C Stops queries running longer than an hour D Hides documents for an hour
A background task removes them roughly once a minute.
Show answer
Complete the value so the price is stored as an exact decimal.
db. products . insertOne ( { name: 'Pen' , price: ( '1.20' ) } )
Decimal128 stores decimal values exactly.
Check answer Show solution
What type does mongosh use for a plain number like 42?
A Int32 B Double C Decimal128 D String
Current mongosh stores whole numbers that fit in 32 bits as Int32; numbers with a decimal point are stored as Double. Use NumberLong for larger integers.
Show answer
A collection has prices 5, '7' and 9. How many documents does this match?
db. c . countDocuments ( { price: { $gt: 4 } } )
A 3 B 1 C 2 D 0
The string '7' isn't compared with numbers.
Show answer
How are dates stored in MongoDB?
A As local time strings B As UTC timestamps (milliseconds since 1970) C As separate day, month and year fields D In the server's time zone
Convert to local time when displaying.
Show answer
Which query finds documents where price is stored as text?
A { price: 'string' } B { price: { $exists: 'string' } } C { $string: 'price' } D { price: { $type: 'string' } }
$type checks the BSON type.
Show answer
Complete the update so 'admin' is added only if it isn't already present.
db. users . updateOne ( { _id: 1 } , { : { roles: 'admin' } } )
$addToSet avoids duplicates.
Check answer Show solution
Which operator removes elements that match a condition?
A $pull B $pop C $unset D $remove
$pop removes only the first or last element.
Show answer
Predict the outputmedium Arrays What is tags after this update if it was ['a', 'b', 'c']?
db. c . updateOne ( { _id: 1 } , { $pop: { tags: 1 } } )
A ['b', 'c'] B ['a', 'b'] C ['a', 'c'] D []
1 removes the last element; -1 removes the first.
Show answer
What does 'items.$.qty' refer to?
A Every item's qty B The last item's qty C The qty of the first array element matched by the query D A field called $
The array field must appear in the query.
Show answer
How do you keep only the 10 newest entries when pushing to an array?
A $push then $pop B $addToSet with a limit C A TTL index D $push with $each, $sort and $slice: 10
$slice caps the array as part of the same update.
Show answer
Complete the query to find customers in Leeds using the embedded address.
db. customers . find ( { ' ': ' Leeds ' })
Dot notation reaches into embedded documents.
Check answer Show solution
When is embedding usually the better choice?
A When data is read together with its parent and stays small B When data grows without limit C When many documents share the data D Never
Addresses and order items are classic examples.
Show answer
Why might you store the customer's name inside each order as well as the customer id?
A It's required B To make the order bigger C So order lists can show the name without another query (an extended reference) D To avoid indexes
The trade-off is keeping the copy up to date.
Show answer
What remains in address after this update if it was { city: 'Leeds', postcode: 'LS1' }?
db. c . updateOne ( { _id: 1 } , { $set: { 'address.city' : 'York' } } )
A { city: 'York' } B { city: 'York', postcode: 'LS1' } C { postcode: 'LS1' } D An error
Dot notation changes one field and keeps the rest.
Show answer
Why can embedding reduce the need for transactions?
A Embedded data can't change B Writes to a single document are atomic, so data embedded together always changes together C Transactions don't work with arrays D Embedding disables writes
Multi-document transactions are only needed across documents.
Show answer
Complete the command that creates an index on email.
db. users . ( { email: 1 } )
createIndex builds an index on the given fields.
Check answer Show solution
Which field is always indexed automatically?
A createdAt B _id C name D None
Every collection has an _id index.
Show answer
An index is { status: 1, createdAt: -1 }. Which query can use it efficiently?
A find({ createdAt: { $gt: d } }) only B find({ total: 5 }) C find({}).sort({ total: 1 }) D find({ status: 'paid' }).sort({ createdAt: -1 })
Queries must use a prefix of the index fields.
Show answer
What does a unique index do?
A Rejects inserts or updates that would create a duplicate value B Makes queries unique C Deletes duplicates D Sorts documents
Duplicates fail with error E11000.
Show answer
In the ESR rule, where do range fields go in a compound index?
A First B Last, after equality and sort fields C Between equality and sort D Anywhere
Equality, then Sort, then Range.
Show answer
Complete the stage that keeps only paid orders.
db. orders . aggregate ( [ { : { status: 'paid' } } ] )
$match filters documents in a pipeline.
Check answer Show solution
What does $group's _id decide?
A The output document's ObjectId B The sort order C The collection name D Which documents are grouped together
Documents with the same _id value form one group.
Show answer
Using the sales collection, how many groups does this produce?
db. sales . aggregate ( [ { $group: { _id: '$month' } } ] )
A 2 B 3 C 6 D 1
There are sales in months 1, 2 and 3.
Show answer
How do you count the documents in each group?
A { $count: 1 } B { $sum: 1 } C { $total: true } D { $length: '$_id' }
Adding 1 for each document counts them.
Show answer
Why should $match usually come first?
A It reduces the documents later stages process and can use indexes at the start B It's required C $group can't run without it D It sorts the documents
Early filtering makes pipelines much faster.
Show answer
Complete the stage that turns each element of items into its own document.
db. orders . aggregate ( [ { : '$items' } ] )
$unwind outputs one document per array element.
Check answer Show solution
What does $sortByCount do?
A Sorts documents by a count field B Counts all documents C Groups by a value, counts each group and sorts by the count D Sorts arrays
It's a shortcut for $group plus $sort.
Show answer
An order with an empty items array goes through { $unwind: '$items' }. How many documents come out for it?
A 1 B 0 C 2 D An error
Empty arrays are dropped unless preserveNullAndEmptyArrays is true.
Show answer
What is $facet useful for?
A Creating indexes B Joining collections C Deleting documents D Running several pipelines over the same input and returning all results together
Common on search pages.
Show answer
What's the difference between $out and $merge?
A $out replaces the target collection; $merge inserts or updates into an existing one B There's none C $merge only works on arrays D $out keeps old documents
$merge suits incrementally updated summaries.
Show answer
Complete the stage name that joins another collection.
db. orders . aggregate ( [ { : { from : 'customers' , localField: 'customerId' , foreignField: '_id' , as : 'customer' } } ] )
$lookup performs a join in the pipeline.
Check answer Show solution
What type is the field created by $lookup's as option?
A A single document B A string C A number D An array
It's an array even if only one document matches.
Show answer
What happens to a document with no matches in a $lookup?
A It's removed B It's kept, with an empty array C It causes an error D It gets null
$lookup behaves like a left outer join.
Show answer
Using the sample data, how many orders does Ada's lookup array contain?
db. customers . aggregate ( [ { $match: { _id: 'c1' } } , { $lookup: { from : 'orders' , localField: '_id' , foreignField: 'customerId' , as : 'o' } } , { $project: { n: { $size: '$o' } } } ] )
A 1 B 3 C 2 D 0
Orders 101 and 103 belong to Ada.
Show answer
Why place $match and $limit before $lookup?
A So only the documents you'll actually return are joined, which saves work B $lookup must come last C To sort the joined array D It's required for indexes
Joining fewer documents is faster.
Show answer
Complete the rule of MongoDB schema design.
together.
Design documents around how the app reads data.
Check answer Show solution
What does the computed pattern store?
A Raw data only B A precalculated value, such as an average, updated when data changes C Copies of every document D Indexes
Reads then avoid expensive calculations.
Show answer
Which pattern keeps the five newest reviews inside a product?
A Bucket B Polymorphic C Outlier D Subset
The full list lives in its own collection.
Show answer
Why group sensor readings into hourly bucket documents?
A To use more storage B Because readings can't be separate documents C To reduce the number of documents and index entries while keeping each document bounded D To avoid dates
Bucketing makes time series storage and queries efficient.
Show answer
What's the purpose of a schemaVersion field?
A To version MongoDB itself B To enable transactions C To speed up queries D To tell old and new document shapes apart so code and migrations can handle both
It lets structure change without downtime.
Show answer
Complete the schema so email must always be present.
{ $jsonSchema: { : [ 'email' ] } }
required lists fields that must be present.
Check answer Show solution
What happens when an insert breaks a validator with the default settings?
A It's rejected with a document validation error B It's saved with a warning C The invalid fields are removed D The collection is dropped
Error code 121 means document validation failed.
Show answer
Which keyword restricts a field to a list of allowed values?
A pattern B enum C allowed D values
For example enum: ['draft', 'live'].
Show answer
What does validationLevel: 'moderate' do?
A Turns validation off B Logs warnings instead of rejecting C Validates inserts, and updates only to documents that already pass the rules D Validates only nested fields
It helps while existing data is being cleaned up.
Show answer
How can you find existing documents that break a schema?
A db.c.validate() B db.c.find({ $invalid: true }) C It isn't possible D db.c.find({ $nor: [{ $jsonSchema: schema }] })
$jsonSchema also works as a query operator.
Show answer
Complete the index definition so title becomes searchable with $text.
db. posts . createIndex ( { title: ' ' })
The value 'text' creates a text index on the field.
Check answer Show solution
How many text indexes can a collection have?
A Two B One per field C Unlimited D One, which can cover several fields
List every searchable field in the single text index.
Show answer
What does $search: 'coffee -decaf' match?
A Documents with both words B Documents mentioning coffee but not decaf C Only the phrase "coffee decaf" D Nothing
A minus sign excludes a word.
Show answer
How do you sort $text results by relevance?
A sort({ _id: 1 }) B sort({ relevance: -1 }) C Results are always unsorted D sort({ score: { $meta: 'textScore' } })
Project the score with the same $meta.
Show answer
Why does a search for "running" find documents containing "runs"?
A Stemming reduces both words to the same root B Fuzzy matching C Synonyms D Regex
Text indexes stem words in the index language.
Show answer
Complete the call that runs and commits a transaction.
session. ( ( ) => {
coll. insertOne ( { _id: 1 } )
} )
withTransaction commits when the function finishes.
Check answer Show solution
Is an update that changes several fields of one document atomic?
A Only in a transaction B Yes, single-document writes are always atomic C Only with a replica set D No
Transactions are for multiple documents.
Show answer
What happens if the function passed to withTransaction throws?
A The completed writes are kept B MongoDB retries forever C The transaction is aborted and none of its writes are kept D The session closes but writes remain
That's atomicity.
Show answer
What do transactions require?
A A replica set or sharded cluster B A standalone server C A text index D Atlas only
Atlas clusters are replica sets.
Show answer
Why put the balance check in the update filter rather than reading first?
A Filters are faster to write B Reads aren't allowed in transactions C It avoids using a session D The check and the change happen in one atomic operation, so nothing can change in between
Check modifiedCount to see if the condition held.
Show answer
Complete the line that collects a cursor's documents into an array.
const docs = await products. find ( { price: { $lt: 10 } } ) . ( ) ;
toArray reads every document from the cursor.
Check answer Show solution
How many MongoClient instances should a typical Node.js server create?
A One per request B One per collection C One, shared by the whole app D One per user
The client manages a pool of connections.
Show answer
Why does findOne({ _id: '64b7f3...' }) return null for an existing document?
A The stored _id is an ObjectId, and a string doesn't match it B The id is too long C findOne needs a projection D The collection is empty
Convert with new ObjectId(id).
Show answer
Which error code means a duplicate key?
A 404 B 11000 C 121 D 500
Map it to 409 Conflict in an API.
Show answer
How do you include an operation in a transaction with the driver?
A Call it inside any async function B Pass { session } in its options inside session.withTransaction C Use a different collection D Set a global flag
Every operation must carry the session.
Show answer
Complete the schema option that adds createdAt and updatedAt automatically.
new mongoose. Schema ( { name: String } , { : true } ) ;
timestamps maintains both date fields.
Check answer Show solution
A An ODM that adds schemas, models and validation on top of the MongoDB driver B A database C A query language D A hosting service
It runs in your Node.js application.
Show answer
Which collection does mongoose.model('Order', schema) use by default?
A Order B order C order_collection D orders
The model name is lowercased and made plural.
Show answer
A Deletes unused fields B Compresses the data C Runs validators D Returns plain JavaScript objects instead of full Mongoose documents
It's much faster for read-only results.
Show answer
What does populate('author') do?
A Replaces the stored author id with the referenced author document B Creates an author C Adds an index on author D Validates the author field
The schema field needs ref: 'Author'.
Show answer
Complete the write concern so the write survives a failover.
db. orders . insertOne ( order, { writeConcern: { w: ' ' } })
majority waits until most members have the write.
Check answer Show solution
Which member of a replica set accepts writes?
A Every secondary B The arbiter C The newest member D The primary
Secondaries copy the primary's changes.
Show answer
How do secondaries stay in sync with the primary?
A They copy files every hour B Applications write to every member C They replay changes from the primary's oplog D They don't
The oplog is an ordered log of every write.
Show answer
Why use an odd number of voting members?
A It's faster B So a majority can always be formed for elections, avoiding ties C MongoDB requires exactly three D Even numbers can't store data
Three members tolerate the loss of one.
Show answer
What's the risk of reading from secondaries?
A Results may be slightly stale because of replication lag B Reads fail C Writes are blocked D Indexes aren't used
Use them for reports, not for reading back fresh writes.
Show answer
Complete the command that shards the orders collection on a hashed customerId.
sh. ( 'shop.orders' , { customerId: 'hashed' } )
shardCollection sets the shard key for a collection.
Check answer Show solution
A Copies all data to every server B Splits a collection's data across several shards to scale horizontally C Compresses data D Creates indexes
Replication copies; sharding splits.
Show answer
Which component routes application queries to the right shards?
A The balancer B A config server C mongos D The primary
Applications connect to mongos routers.
Show answer
Why is an always-increasing value a poor ranged shard key?
A It's too short B It can't be indexed C It has low cardinality D Every new insert goes to the same chunk and shard, creating a write hot spot
Hash it, or lead with a different field.
Show answer
What's a scatter-gather query?
A A query using a hashed index B A query that returns no results C A query without the shard key, which mongos must send to every shard D A query on config servers
Including the shard key makes queries targeted.
Show answer
Complete the role so the app can read and write the shop database.
db. createUser ( { user: 'app' , pwd: passwordPrompt ( ) , roles: [ { role: ' ', db: ' shop' }] })
readWrite allows reading and changing data in one database.
Check answer Show solution
What does least privilege mean?
A Everyone gets admin rights B Users can't log in C Each user gets only the permissions it needs D Only one user exists
Leaked credentials then do limited damage.
Show answer
Which built-in role can read but not change data?
A read B readWrite C dbAdmin D userAdmin
Ideal for reporting tools.
Show answer
Why use passwordPrompt() when creating users?
A It generates passwords B It encrypts the database C It's required D It asks for the password interactively, so it isn't saved in shell history
Typed-in passwords end up in history files.
Show answer
How does NoSQL injection happen?
A Through SQL strings B Through indexes C User input containing query operators, like { "$ne": null }, is placed directly into a filter D Through replication
Validate types or cast to strings before querying.
Show answer
Complete the command that makes a compressed logical backup.
--uri "$URI" --db shop --gzip --archive = shop. gz
mongodump exports databases as BSON.
Check answer Show solution
Does a replica set protect you from accidentally deleting data?
A Yes B Only secondaries keep old data C No, the deletion is replicated to every member D Only with majority write concern
Only backups let you go back in time.
Show answer
Which tool restores a mongodump archive?
A mongoimport B mongosh --load C mongostat D mongorestore
mongoimport loads JSON or CSV files.
Show answer
A How fast queries run B How many replicas you have C How much data, measured in time, you can afford to lose D Backup file size
RTO is how quickly you must recover.
Show answer
How can you recover one collection without overwriting live data?
A Restore it into a different namespace with --nsFrom and --nsTo, then copy back what's needed B mongorestore --drop C Use mongoexport D Restart the server
Then compare the restored data with live data.
Show answer
After the worked $unset on contact 4, which contacts have no email field?
A 2 and 4 B 1 and 4 because null always means absence C Only 2 because unset stores an empty string
Contact 2 started missing and contact 4 becomes missing; contact 1 still stores null.
Show answer
After the worked cursor reads _id 1 with next, what does toArray return?
A The remaining identifiers 2, 3, 4, and 5 B All identifiers 1 through 5 because toArray rewinds C Only identifier 2 because batchSize is two
The cursor has advanced; toArray consumes all remaining results and batchSize does not impose a total limit.
Show answer
How many documents does the second worked SKU upsert bulk create?
A Zero B Two new duplicates because unordered ignores unique indexes C One because only the last model can be rerun
Both unique SKU identities already exist, so the repeated desired-value updates create no new documents.
Show answer
After the worked independent-field merge, what city remains?
A York B Leeds because the stale snapshot replaces the whole profile C Grace because every field uses the new display name
The merge sets only displayName and preserves the accepted city change.
Show answer
What rank and dense rank does score 80 receive after two tied scores of 90?
A Rank 3 and dense rank 2 B Rank 2 and dense rank 3 C Both 1 because every row shares one collection
Competition rank leaves a gap after two first-place rows; dense rank advances to the next distinct score group.
Show answer
Does the worked half-open daily range include the event exactly at end?
A No; end belongs to the next day B Yes; $lt includes equality automatically C Only if the server uses the New York timezone globally
The upper comparison is strictly less than end, preventing double counting at the next midnight.
Show answer
What value does the worked locf report show at the leading position -1?
A null because no earlier value exists B 10 because locf always reads the next value C 0 because every missing measurement is an observed zero
locf carries a preceding value and cannot fill a leading gap from a future observation.
Show answer
After order 3 becomes unpaid, how many source orders remain in the worked collection?
A Three B One because the view deletes excluded rows C Two because tenant B is removed from storage
The view filters output only; updating paid does not delete any source order.
Show answer
What active report is visible after building g2 but before publishing its pointer?
A The g1 report containing A 10 and B 5 B The g2 report automatically, because merge changes the pointer C A mixture selected by source insertion order
Building rows does not change the active pointer; publication is a separate explicit step.
Show answer
What counter value remains after the worked handler receives the same event twice?
A One B Two because every resume token must increment twice C Zero because a transaction cannot store a token
The first transaction applies the effect and records the key; the second recognizes the duplicate.
Show answer
Which values contribute to the practice total for the noon-to-one interval?
A 10 and 14, totaling 24 B 10, 14, and 99, totaling 123 C Only 14, because $gte excludes noon
The interval includes its noon start with $gte and excludes the one-o’clock end with $lt.
Show answer
After the practice publishes version two, what does downloading oldId return?
A version one B version two, because both filenames are notes.txt C A missing-file error, because updating the pointer deletes old chunks
The pointer update changes version selection in an ordinary document; it does not delete or mutate the first uploaded file.
Show answer
Why does the practice return IDs 2 and 3 instead of closed ID 1?
A The open predicate is applied inside geoNear before the limit B geoNear automatically excludes every document with _id 1 C The distance field removes zero-distance locations
The query option imposes the ordinary open eligibility rule before the pipeline takes its two nearest candidates.
Show answer
Which student has one score between ninety and ninety-five inclusive?
A Only ID 2, whose array contains 92 B IDs 1 and 2, because 70 and 100 average into the interval C Only ID 1, because two elements are required
The elemMatch requirement applies both comparisons to one actual element; averaging is not part of this predicate.
Show answer
Which lookup in the main fixture finds the stored Ada for lowercase ada?
A The equality query with English strength-two collation B The query without collation, because the index changes the collection default C Both queries, because collation rewrites stored names to lowercase
The operation must use the applicable matching comparison rules; the index neither changes the collection default nor rewrites the value.
Show answer
Which main-fixture product matches missing attributes.weight?
A Only ID 4 B IDs 1 and 4, because weight four is below eight C All four, because wildcard indexes remove missing fields
The predicate checks field absence, not a numeric threshold; products one through three each store a weight.
Show answer
Why can the practice raise MongoServerSelectionError despite its TCP listener accepting connections?
A The endpoint does not complete a usable MongoDB handshake B Any local TCP server automatically counts as a selectable MongoDB server C maxPoolSize one forbids establishing the first connection
Server selection requires a suitable MongoDB server, not merely an accepted TCP socket.
Show answer
No exercises match those filters.