MongoDB
C100DBA · Question #36
C100DBA Question #36: Real Exam Question with Answer & Explanation
The correct answer is C. db.posts.createIndex({comments.author":-l});. See the full explanation below for the reasoning.
Question
Given a collection posts as shown below having a document array comments, which of the following command will create an index on the comment author descending?
Exhibit
Options
- Adb.posts.createIndex({commerits.$.author":-l});
- Bdb.posts.createIndex({comments.$.author": {$desc:l>});
- Cdb.posts.createIndex({comments.author":-l});
Community Discussion
No community discussion yet for this question.
