Be able to map a query's equality, sort, and range fields to a compound index key order, and to spot multikey and parallel-array problems. The most important thing: get field order right, since equality fields precede sort fields, and confirm with explain().
Start practicing
Indexing — choose a session length
Free · No account required
Domain overview
This domain covers MongoDB index types, compound index field order, index selection, and how indexes affect read and write performance. Questions present realistic query patterns and schema shapes, then ask you to choose or evaluate an index definition, predict multikey behavior, or explain write overhead. You must reason about equality, sort, and range fields together.
Exam objectives
Choosing compound index field order for queries combining equality filters and sorts
Recognizing multikey indexes and the restriction on indexing parallel arrays
Using explain() to identify COLLSCAN, IXSCAN, and index usage in winning plans
Evaluating write amplification and storage cost from excess indexes on a collection
Creating an index on two array fields in one document, which MongoDB rejects as a parallel-array multikey index.
Placing the sort field before equality fields in a compound index, preventing the index from supporting the sort.
Assuming an index helps every query; low-selectivity or unused indexes only add write and storage overhead.
Click any question to see the full explanation and answer options, or start a focused practice session above.
You have a collection of user activity logs where queries frequently filter by `userId` and sort by `timestamp` in descending order. Which single index definition provides optimal support for this query pattern without requiring an in-memory sort?
2An e-commerce application frequently executes a query filtering by 'category' and 'brand', and then sorts the results by 'price' in ascending order. You created a compound index on { category: 1, brand: 1, price: 1 }. Which statement best describes how MongoDB utilizes this index for a query that filters only on 'brand' and 'price'?
3You are designing a schema for a social media platform where users have an array of 'tags' and an array of 'mentions'. You attempt to create an index on { tags: 1, mentions: 1 }. What is the most likely outcome of this operation?
4Your application executes the query: db.users.find({ age: { $gt: 30 } }, { age: 1, _id: 0 }). You have an index on { age: 1 }. How does MongoDB process this query?
5You are considering using a hashed index for a 'product_id' field to distribute data across shards. Which of the following is a known limitation of hashed indexes in MongoDB?
6Refer to the exhibit. If a query is executed as db.collection.find({ "metadata.type": "book" }), how will MongoDB use the created index?
7When creating an index on a large collection in a production environment, what is the primary advantage of using the 'background' option (for versions prior to 4.2) or the standard build process in 4.2+?
8You are optimizing a query: db.orders.find({ status: 'urgent', amount: { $gt: 500 } }).sort({ order_date: -1 }). According to the ESR (Equality, Sort, Range) rule, what is the ideal index for this query?
9A developer wants to implement full-text search on a collection of articles. They create a text index on the 'content' field. Which of the following is a significant limitation of 'text' indexes in MongoDB?
10You are storing GPS coordinates in a 'locations' collection using GeoJSON format. You need to perform queries that find points within a specific polygon. Which index type must be created on the location field?
11You are optimizing a collection containing user logs. Queries frequently filter by 'category' and sort by 'timestamp' in descending order. Which index configuration best supports these queries while maintaining efficiency?
12You need to ensure that values in the 'email' field are unique across all documents in a collection, but documents where the 'email' field is missing should not violate this constraint. How should you create this index?
13Which index type should be used to support efficient queries on a field containing geographical coordinates in MongoDB?
14Which TWO of the following statements regarding the ESR rule for index creation are true?
15What is the primary consequence of having too many indexes on a collection that experiences a high volume of write operations?
16Which property of a Multikey Index is true when indexing an array field?
17What is the primary function of the explain() method in MongoDB?
18What is the primary benefit of using a partial index in MongoDB?
19When should a TTL (Time-To-Live) index be used in a MongoDB collection?
20What is the primary technical limitation when creating a covered query?
21A support team frequently runs a query that filters on status and sorts by created_at, both fields in the same collection. An existing index { status: 1 } is in place, but the query still performs an in-memory sort and gets killed once result sets grow past the 100 MB sort limit. Which index should you create to let the server satisfy both the filter and the sort without a blocking sort stage?
22An application queries a users collection with db.users.find({ email: "a@b.com" }). The collection holds about 2 million documents, and the email field is unique for every user. A developer proposes creating an index { email: 1, country: 1 } to speed up the query. What is the most accurate assessment of this proposal?
23A logistics application stores shipment records in a collection where each document has a numeric field `weight_kg`. Queries frequently filter on `weight_kg` with a range (e.g., between 50 and 200) and sort by `weight_kg` ascending. You create a standard ascending index on `weight_kg`. Which statement best describes the index's behavior for these queries?
24A logistics company stores shipment events in a collection where each document contains a `history` array of subdocuments with fields `status`, `timestamp`, and `location`. Queries frequently filter on `history.status` and sort by `history.timestamp`. An index is created on `history.status`. What is the most accurate statement about this index?
25A financial application has a collection `transactions` with fields `accountId`, `type`, `amount`, and `createdAt`. A query filters on `accountId` and `type`, sorts descending by `createdAt`, and projects only `_id` and `amount`. A developer creates the index `{ accountId: 1, type: 1, createdAt: -1 }`. Which statement best describes whether this index can support the query as a covered query?
26A logistics application stores shipment records in a collection named `shipments`. Each document includes a `status` field (e.g., "in_transit", "delivered") and a `delivery_date` field. The development team frequently runs a query that filters on `status` and sorts by `delivery_date` in ascending order. They want to create a compound index to optimize this query. Which index should they create?
27A retail application queries an `orders` collection with a filter on `status` and `customerId`, and a sort on `orderDate`. The query shape is: `db.orders.find({ status: "shipped", customerId: 12345 }).sort({ orderDate: -1 })`. The collection has no indexes other than the default `_id` index. Which index should be created to best support this query according to the ESR guideline?
28A developer is working with a collection that stores user profiles. The collection has an index on the `email` field. The developer runs a query that uses a regular expression to find all users whose email ends with "@example.com". The query is: `db.users.find({ email: /@example\.com$/ })`. What is the most likely behavior of this query with respect to the index?
29A developer is working with a MongoDB collection that stores user profiles. The collection has a unique index on `email` and a compound index on `{ lastName: 1, firstName: 1 }`. The developer needs to enforce that no two documents have the same combination of `tenantId` and `username`. Which TWO of the following statements are correct regarding the creation and behavior of a unique compound index for this requirement? (Choose two.)
30A developer maintains a collection of sensor readings. Queries almost always filter on `status` and then sort by `timestamp` descending. The current index is { status: 1, timestamp: 1 }. The developer observes that the query planner selects a COLLSCAN even though the index covers both fields. Which index change should be made to allow an efficient index scan for this query?
31An IoT platform stores sensor readings in a collection `readings` with fields `deviceId`, `timestamp`, and `value`. The collection is large and grows continuously. Queries typically retrieve the most recent readings for a specific device, filtering by `deviceId` and sorting by `timestamp` descending. The operations team wants to minimize index size while still supporting these queries efficiently. Which index strategy best meets this requirement?
32An application writes documents to a `metrics` collection where each document contains an embedded array `samples` of subdocuments with fields `value` and `unit`. A query filters on `samples.unit` and `samples.value` together, expecting both conditions to match the same array element. The developer creates { "samples.unit": 1, "samples.value": 1 }. Which behavior should the developer expect from this index?
33A collection 'orders' has a compound index { status: 1, customerId: 1, orderDate: -1 }. A developer runs a query: db.orders.find({ customerId: 'C123', status: 'shipped' }).sort({ orderDate: -1 }). Which statement about how MongoDB uses this index for the query is correct?
34A team stores user profiles in a `profiles` collection. About 90% of documents have a `deletedAt` field set to null, and only 10% have an actual timestamp indicating soft deletion. Queries that list active users filter on `deletedAt: null` and sort by `createdAt`. The team wants an index that stays small and avoids maintaining entries for deleted documents. Which index definition best matches this requirement?
35You are the lead developer for a high-traffic e-commerce application using MongoDB 6.0. A query on the `orders` collection that filters on `customerId` and sorts by `orderDate` in descending order is performing poorly. You decide to create an index to improve its performance. Which of the following indexes would be most efficient for this query?
36A developer is working with a collection 'products' that has an index { category: 1, price: 1 }. They want to understand how MongoDB can use this index for queries that include a sort on price. Which TWO of the following statements are true regarding the use of this index for sorting? (Choose two.)
37A MongoDB collection contains documents with a field `tags` that is an array of strings. A developer creates an index on the `tags` field. Which of the following statements is true about the resulting index?
38A developer needs to ensure that a `users` collection does not contain two documents with the same email address. Which index type should be created on the `email` field?
39A developer is tuning indexes on an `orders` collection. The team reports slow queries and heavy write latency, and they suspect too many indexes. Which TWO practices should the developer apply when reviewing the index set? (Choose two.)
40A developer is working with a MongoDB collection that stores user profiles. The collection has an index on the `email` field. The developer runs a query to find a user by email and then examines the query plan using `explain()`. The output shows that the query used an `IXSCAN` stage. What does this indicate about the query execution?
41A developer is working with a collection that has a compound index on { a: 1, b: 1, c: 1 }. They run a query that includes a filter on `a` and a sort on `c`. The query is: `db.collection.find({ a: 5 }).sort({ c: 1 })`. Which of the following best describes how MongoDB will execute this query?
42A collection 'logs' has a TTL index on the 'createdAt' field with expireAfterSeconds set to 3600. A developer notices that some documents older than one hour are still present in the collection. Which explanation is most likely?
43A logistics application stores shipment records in a MongoDB collection where each document includes a 'status' field (e.g., 'pending', 'in_transit', 'delivered') and a 'createdAt' date. The operations team frequently runs the query: db.shipments.find({ status: 'in_transit' }).sort({ createdAt: -1 }).limit(20). They want an index that allows this query to execute without an in-memory sort and with minimal keys scanned. Which index should you create?
44You are managing a MongoDB collection that stores sensor data. Each document has a `timestamp` field and a `sensorId` field. The collection is very large, and you need to optimize a query that finds the most recent reading for a specific sensor. The query is: `db.sensors.find({ sensorId: 'abc123' }).sort({ timestamp: -1 }).limit(1)`. Which index would best support this query?
45A financial analytics collection stores documents with fields 'accountId' (string), 'transactionDate' (date), and 'amount' (decimal). A common query is: db.transactions.find({ accountId: 'A123', transactionDate: { $gte: ISODate('2024-01-01'), $lte: ISODate('2024-01-31') }, amount: { $gt: 1000 } }). You need an index that supports this query efficiently. Following the ESR rule, which index key pattern is optimal?
46You are designing indexes for a MongoDB collection that stores user profiles. The collection has a field 'email' that must be unique, and a field 'username' that is also unique. You also need to support queries that find users by a combination of 'country' and 'city'. Which TWO of the following statements are correct regarding index creation and behavior in this scenario? (Choose two.)
47A developer is working with a MongoDB collection that stores sensor readings. Each document has a 'sensorId' field and a 'readings' array containing numeric values. The developer creates an index on the 'readings' field. Which statement best describes the resulting index?
48A developer is working with a MongoDB collection that has a partial index defined as `db.products.createIndex({ price: 1 }, { partialFilterExpression: { price: { $gt: 100 } } })`. The developer runs a query `db.products.find({ price: { $lt: 50 } })`. Which of the following statements describes how MongoDB will execute this query?
Be able to map a query's equality, sort, and range fields to a compound index key order, and to spot multikey and parallel-array problems. The most important thing: get field order right, since equality fields precede sort fields, and confirm with explain().
The Courseiva C100DEV question bank contains 48 questions in the Indexing domain. Click any question to see the full explanation and answer breakdown.
Start with a 10-question focused session to identify your baseline accuracy in this domain. Read every explanation — even for questions you answer correctly — to understand the reasoning. Once you score consistently above 80%, move to a 20–30 question session to confirm depth before moving to the next domain.
Yes — the session launcher on this page draws questions exclusively from the Indexing domain. Choose 10, 20, 30, or 50 questions for a focused session, or click individual questions to review them one by one.
Save your results, see per-domain analytics, and get readiness scores — free, for every certification.
Sign Up FreeFree forever · Every certification included