Deal of The Day! Hurry Up, Grab the Special Discount - Save 25% - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

MongoDB C100DBA Exam - Topic 7 Question 136 Discussion

Posted by Herman on Oct 25, 2026 at 05:59 PM

What command lists all indexes for a collection?

Suggested Answer: D

db.collection.getIndexes() is the mongosh method used to return the definitions of all indexes that currently exist on a collection. The result is an array of index specification documents that can show fields such as the index name, key pattern, index version, uniqueness, partial-filter settings, sparse configuration, collation, and whether the index is hidden. This makes the method useful for index audits, troubleshooting, and confirming the physical indexes available to the query planner. Option A is not a documented method for enumerating collection indexes. Option B resembles the $indexStats aggregation stage, which reports usage statistics for indexes, but db.collection.indexStats() is not the method used to list full index definitions. Option C, findIndexes(), is also not the documented mongosh collection helper. Administrators should distinguish between listing index definitions, examining index usage, and inspecting an individual query's winning plan: getIndexes() addresses the first requirement, $indexStats addresses usage metrics, and explain() addresses query-planner behavior. Therefore option D is the correct command for listing all indexes on the collection.

Study Guide reference/topic:Indexing and Query Optimization - index administration, index metadata, and db.collection.getIndexes().

===========


Get Premium C100DBA Questions as Interactive Web-Based Practice Test or PDF Real Exam Format Detailed Explanations Instant Access Get Your Practice Test
0 comments · newest first

Currently there are no comments in this discussion, be the first to comment!

0/2000 characters

Save Cancel