MongoDB C100DEV Practice Questions with Explanations

Free MongoDB C100DEV practice questions. 10 of them, each with the correct answer, a full explanation, and the reason every other option is wrong.

C100DEV practice questions

Question 1

What C# statement inserts a document?

  • A. collection.insertOne(document);
  • B. collection.insertSingle(document);
  • C. document.insertSingle(collection);
  • D. document.InsertOne(collection);
Show answer and explanation ▾

Correct answer: A

A single document is inserted by calling the insert one method on the collection object and passing the document as the argument.

Why the other options are wrong:

  • B. The collection has no insertSingle method.
  • C. The insert is called on the collection, and there is no insertSingle method.
  • D. The insert is called on the collection with the document as the argument, not on the document.

Question 2

A developer is working on a MongoDB database that contains a collection named routes. Each document in the routes collection includes the field stops. The developer wants to find all routes that have more than 0 stops.

Which query should the developer use?

  • A. db.routes.find({ "stops": { $ne: 0 } })
  • B. db.routes.find({ "stops": { $gte: 0 } })
  • C. db.routes.find({ "stops": { $gt: 0 } })
  • D. db.routes.find({ "stops": { $eq: 0 } })
Show answer and explanation ▾

Correct answer: C

$gt matches values that are strictly greater than the given value, so { stops: { $gt: 0 } } returns only routes with more than 0 stops.

Why the other options are wrong:

  • A. $ne matches every value other than 0, which is not the same as greater than 0.
  • B. $gte also returns routes with exactly 0 stops.
  • D. $eq returns only routes with exactly 0 stops.

Question 3

Which TWO statements are true about the NET/C# Driver? (Choose two.)

  • A. The driver automatically sorts the results.
  • B. The drivers first authentication mechanism preference is x509.
  • C. The driver supports client-side field level encryption.
  • D. The driver can be downloaded via NuGet.
Show answer and explanation ▾

Correct answer: C, D

The .NET/C# driver is distributed as a NuGet package, and it supports client-side field level encryption so that chosen fields are encrypted before they leave the application.

Why the other options are wrong:

  • A. Results come back in no guaranteed order unless the query specifies a sort.
  • B. x509 is not the driver's first choice of authentication mechanism.

Question 4

Which TWO C# statements will return the following document? (Choose two.) { _id:

1, year: 1967 }

  • A. coll.Find( Builders.Filter.Eq("year", 1967) ).FirstOrDefault();
  • B. coll.Find( "year", 1967).FirstOrDefault();
  • C. coll.Find( Builders.Filter.Eq("year", 1967) ).First();
  • D. coll.FindOne( Builders.Filter.Eq("year", 1967) );
Show answer and explanation ▾

Correct answer: A, C

Find takes a filter built with Builders and returns a fluent result. Calling First or FirstOrDefault on it returns the first matching document, here the one with year 1967.

Why the other options are wrong:

  • B. Find takes a filter definition, not a field name and a value as two arguments.
  • D. FindOne is not a method on the collection in the current driver.

Question 5

Given the following query:

db.coll.find({}).sort({"timestamp":

-1, "status": 1})

Which TWO indexes will improve the performance of this query the MOST? (Choose two.)

  • A. {"status": 1, "timestamp": -1}
  • B. {"timestamp": -1, "status": 1}
  • C. {"timestamp": 1, "status": -1}
  • D. {"timestamp": -1, "status": -1}
  • E. {"timestamp": 1, "status": 1}
Show answer and explanation ▾

Correct answer: B, C

A compound index supports a sort when the sort directions match the index exactly or are its exact inverse, with the fields in the same order. { timestamp: -1, status: 1 } matches the sort and { timestamp: 1, status: -1 } is its inverse, which is read backward.

Why the other options are wrong:

  • A. The fields are in the wrong order, so the index cannot provide this sort.
  • D. The directions neither match the sort nor are its inverse.
  • E. The directions neither match the sort nor are its inverse.

Question 6

What is the best practice for connecting to a MongoDB cluster with the Java Driver?

  • A. A single, cached MongoClient instance
  • B. A new MongoClient instance for each logical transaction
  • C. A new MongoClient instance for each request
  • D. A pool of MongoClient instances to allow multiple concurrent database requests
Show answer and explanation ▾

Correct answer: A

A MongoClient is thread safe and has its own connection pool, so an application should create one and reuse it.

Why the other options are wrong:

  • B. Creating a client per transaction wastes connections and setup time.
  • C. Creating a client per request is wasteful for the same reason.
  • D. A pool of clients is redundant because each client already pools connections.

Question 7

A collection coll has the following documents:{_id: 4, type: “A”, value: 60}{_id: 5, type: “B”, value: 80}{_id: 6, type: “A”, value: 30}A collection results has the following documents:{_id: 1, type: “A”, value: 10}{_id: 2, type: “B”, value: 20}{_id: 3, type: “C”, value: 30}After executing the following aggregation pipeline:db.coll.aggregate([{ $match: { type: “A” }},{ $out: ‘results’} ])What is the result?

  • A. Collection results has the following documents:{_id: 4, type: “A”, value: 60}{_id: 6, type: “A”, value: 30}
  • B. Collection results has the following documents:{_id: 1, type: “A”, value: 10}{_id: 4, type: “A”, value: 60}{_id: 6, type: “A”, value: 30}
  • C. Collection results has the following documents:{_id: 1, type: “A”, value: 10}{_id: 2, type: “B”, value: 20}{_id: 3, type: “C”, value: 30}{_id: 4, type: “A”, value: 60}{_id: 6, type: “A”, value: 30}
  • D. Collection results has the following documents:{_id: 1, type: “A”, value: 10}{_id: 2, type: “B”, value: 20}{_id: 3, type: “C”, value: 30}{_id: 4, type: “A”, value: 60}{_id: 5, type: “B”, value: 80}{_id: 6, type: “A”, value: 30}
Show answer and explanation ▾

Correct answer: A

$out writes the pipeline output into the target collection and replaces what was there. Only the two type A documents from coll remain in results.

Why the other options are wrong:

  • B. $out does not keep the old documents in results.
  • C. $out does not append to the existing documents.
  • D. $out does not merge, and $match removes the type B document anyway.

Question 8

In an employee collection, each document represents an employee of the company.What data model is the most effective for tracking the relationship between an employee and their manager?

  • A. Reference array to employee documents in each manager document
  • B. Embed manager document into each employee document
  • C. Embed employee documents as an array into each manager document
  • D. Reference to manager document in each employee document
Show answer and explanation ▾

Correct answer: D

Each employee has one manager, so a single reference to the manager in each employee document tracks the relationship without duplicating data.

Why the other options are wrong:

  • A. A reference array in each manager document has to be updated whenever an employee changes manager.
  • B. Embedding the manager duplicates the manager's data in every employee document.
  • C. Embedding employees inside manager documents nests and duplicates data across the hierarchy.

Question 9

Given the following query:db.coll.find({}).sort({“timestamp”: -1, “status”: 1})Which two indexes will most improve the performance of this query?

(Choose two.)

  • A. {“timestamp”: -1, “status”: -1}
  • B. {“timestamp”: 1, “status”: -1}
  • C. {“timestamp”: -1, “status”: 1}
  • D. {“timestamp”: 1, “status”: 1}
Show answer and explanation ▾

Correct answer: B, C

A compound index supports a sort when the sort keys follow the index order and the directions match the index exactly or are its exact inverse. For sort {timestamp: -1, status: 1}, the index {timestamp: -1, status: 1} matches and {timestamp: 1, status: -1} is the inverse.

Why the other options are wrong:

  • A. {timestamp: -1, status: -1} neither matches nor inverts the sort.
  • D. {timestamp: 1, status: 1} neither matches nor inverts the sort.

Question 10

Given the following query:db.restaurants.find({“borough” : “Brooklyn” , “grades.score” : {$gt:5}})No index exists for the restaurant collection.What index definition most improves the performance?

  • A. db.restaurants.createIndex({“borough” : 1, “grades.score” : 1} )
  • B. db.restaurants.createIndex({“grades.score” : 1, “borough” : 1} )
  • C. db.restaurants.createIndex({“borough” : 1} )
  • D. db.restaurants.createIndex({“grades.score” : 1} )
Show answer and explanation ▾

Correct answer: A

The query has an equality match on borough and a range on grades.score. A compound index with the equality field first and the range field second lets MongoDB jump to Brooklyn and then scan only the scores above 5.

Why the other options are wrong:

  • B. Putting the range field first makes MongoDB scan many more index entries before applying the borough match.
  • C. An index on borough alone leaves the score condition to be checked document by document.
  • D. An index on grades.score alone leaves the borough condition to be checked document by document.

Get the complete C100DEV bank

These 10 questions are roughly 10% of the bank. The full pack has 98 real exam questions, each with the same depth of explanation, plus a questions-only PDF for timed practice and free updates forever.

View the full MongoDB C100DEV question bank →

About the C100DEV exam

These 10 MongoDB C100DEV questions are free here. The free sample PDF has 15.

Back to blog