Mongodb Certified Developer Associate C100dev · Free Practice Question Easy

Question 7

Which command do you use to display all indexes in routes collection?

  • A

    db.routes.getIndexes()

  • B

    db.routes.idx()

  • C

    db.routes.indexes()

  • D

    db.routes.dropIndex()

Reveal correct answer

Correct answer: A

A.

The getIndexes() command is used to display all indexes in a MongoDB collection. When executed on the routes collection, db.routes.getIndexes() will return information about all the indexes defined on that collection, including their names, keys, and other details.

B.

This command is not a valid command in MongoDB. The correct command to display all indexes is getIndexes().

C.

This command is not a valid command in MongoDB. The correct command to display all indexes is getIndexes().

D.

This command is used to drop a specific index from the routes collection, not to display all indexes. It is not the correct command for the given task of displaying all indexes.

Discussion

Think the marked answer is wrong, or have a better explanation? Share it below — comments appear after review.

You must be logged in to post a comment.

Preparing For

Your Certification?

255+ certifications
Detailed explanations
Free PDF samples

Has All The Questions You Need