Deal of The Day! Hurry Up, Grab the Special Discount - Save 25% - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

MongoDB Exam C100DBA Topic 1 Question 64 Discussion

Actual exam question for MongoDB's C100DBA exam
Question #: 64
Topic #: 1
[All C100DBA Questions]

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?

Show Suggested Answer Hide Answer
Suggested Answer: A, B, C

Contribute your Thoughts:

Rosalyn
46 minutes ago
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.
upvoted 0 times
...
Susana
7 days ago
I'm not sure, but I think option A might be correct as it mentions creating an index on comment author in descending order.
upvoted 0 times
...
Delisa
9 days ago
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.
upvoted 0 times
...
Marshall
9 days ago
I agree with Chara, option B seems to be the right choice because it specifies the index on comment author in ascending order.
upvoted 0 times
...
Chara
10 days ago
I think the correct command is B) db.posts.createIndex({^comments.author :1});
upvoted 0 times
...

Save Cancel