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?
I think the answer is A. db.posts.createIndex({\'^comments.$.author\':-1}). It seems to create an index on the 'author' field of the 'comments' subdocument in descending order.
The correct answer is B. db.posts.createIndex({\'comments.author\':1}). The command creates an index on the 'author' field of the 'comments' subdocument in the 'posts' collection, in ascending order.
Rosalyn
46 minutes agoSusana
7 days agoDelisa
9 days agoMarshall
9 days agoChara
10 days ago