C100DEV Drivers, Tools, Transactions, and Search Practice Question
A developer runs `mongosh` against a replica set and wants to inspect the current database's collections before writing any queries. Which command should be executed?
⚠ Common exam trap
Watch out — candidates often confuse a shell helper that lists collection names with a method that queries documents inside a collection.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
show collections
The shell helper `show collections` is the idiomatic mongosh command for listing collections in the active database. It is concise, requires no JavaScript and directly satisfies the developer's need to inspect the database before writing queries. Other options either query a nonexistent collection, return different metadata or list databases rather than collections.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
db.runCommand({ listDatabases: 1 })
Why it's wrong here
`listDatabases` returns database names and sizes, not the collections inside the current database. It requires appropriate privileges and is intended for administrative inspection of databases. It fails here because the developer wants collections, not databases, and a targeted command is more appropriate.
- ✗
db.collections.find()
Why it's wrong here
`db.collections.find()` tries to query a collection literally named `collections`, which usually does not exist. It returns an empty cursor or an error rather than the list of collections. It fails here because the developer needs metadata about collections, not documents inside a collection.
- ✓
show collections
Why this is correct
In mongosh, `show collections` is a shell helper that lists all collections in the currently selected database. It maps to a listCollections command and is the quickest way to inspect schema-less structure without writing JavaScript. This matches the scenario because the developer wants a simple inventory of collections before writing queries.
- ✗
db.getCollectionInfos()
Why it's wrong here
`db.getCollectionInfos()` returns an array of documents with collection metadata, but it is not the standard interactive shell helper for a quick listing. It is more verbose and less commonly used in the shell for day-to-day inspection. It fails here because the scenario asks for the simplest command to see collection names.
About these practice questions
Courseiva writes every C100DEV question from scratch — 259 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →
JA
Written and reviewed by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
Last reviewed September 2026 · checked against the official MongoDB exam blueprint
This C100DEV practice question is part of Courseiva's free MongoDB certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the C100DEV exam.