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?

Posted by: Pdfprep Category: C100DBA Tags: , ,

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?

MongoDB-C100DBA5_1

A . db.posts.createIndex({commerits.$.author":-l});
B . db.posts.createIndex({comments.$.author": {$desc:l>});
C . db.posts.createIndex({comments.author":-l});

Answer: C

Leave a Reply

Your email address will not be published.