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:

Cora
13 days ago
I'm going with B. db.posts.createIndex({\'comments.author\':1}). It's the only one that looks like it actually creates an index on the 'comments' subdocument. The others seem a bit... creative.
upvoted 0 times
...
Gerardo
14 days ago
Hmm, this one's tricky. Is the answer B? db.posts.createIndex({\'comments.author\':1})? I hope I'm not just making a comment on the wrong post!
upvoted 0 times
...
Lashawn
17 days ago
I'm pretty sure the correct answer is C. db.posts.createIndex({\'^commerits.author\':-1}). Oops, my bad, I misspelled 'comments'!
upvoted 0 times
...
Rosalyn
2 months 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
Monroe
28 days ago
User2: I think it might be B) db. posts.createIndex({^comments.author\' :1}).
upvoted 0 times
...
Tricia
1 months ago
User1: I agree with you, A) db.posts.createIndex({^comments.$.author\':-1}) looks like the correct command.
upvoted 0 times
...
...
Susana
2 months 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
2 months 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
Maira
20 hours ago
Oh, I see. Thanks for clarifying. I was confused between A and B.
upvoted 0 times
...
Brittni
7 days ago
No, I believe the correct answer is B) db.posts.createIndex({^comments.author\' :1});
upvoted 0 times
...
Kassandra
30 days ago
I think the answer is A) db.posts.createIndex({^comments.$.author\':-1});
upvoted 0 times
...
...
Marshall
2 months 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
2 months ago
I think the correct command is B) db.posts.createIndex({^comments.author :1});
upvoted 0 times
...

Save Cancel