Black Friday Reward - Upto 75% off - Ends in 0d 00h 00m 00s - Coupon code: CFsave75

MongoDB Associate Database Administrator(Based on MongoDB 6.0 and 7.0+) C100DBA Question # 35 Topic 4 Discussion

MongoDB Associate Database Administrator(Based on MongoDB 6.0 and 7.0+) C100DBA Question # 35 Topic 4 Discussion

C100DBA Exam Topic 4 Question 35 Discussion:
Question #: 35
Topic #: 4

A user stores movie data in a collection called movies. The collection contains thousands of documents.

A sample document looks like this:

{ " title " : " Titanic " , " year " : 1997, " rating " : 8.6 }

The user runs the following query to sort movies first by year, and then by rating:

db.movies.find().sort({ " year " : 1, " rating " : -1 })

Which index would improve the query ' s performance the MOST?


A.

db.movies.createIndex({ " year " : 1, " title " : 1, " rating " : -1 })


B.

db.movies.createIndex({ " year " : -1, " rating " : 1 })


C.

db.movies.createIndex({ " rating " : 1, " year " : -1 })


D.

db.movies.createIndex({ " rating " : -1, " year " : 1 })


Get Premium C100DBA Questions

Contribute your Thoughts:


Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.