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
9 days agoSusana
16 days agoDelisa
18 days agoMarshall
18 days agoChara
19 days ago