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
2 months 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
2 months 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
2 months 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
Quentin
10 days ago
Lamar: Oops, my bad, I misspelled 'comments'! So, the correct answer is C) db.posts.createIndex({'comments.author':-1}).
upvoted 0 times
...
Nieves
11 days ago
User 3: Actually, I think it's C) db.posts.createIndex({'comments.author':-1}).
upvoted 0 times
...
Elmira
21 days ago
User 3: Oops, my bad, I misspelled 'comments'! The correct answer is B) db.posts.createIndex({^comments.author\' :1});
upvoted 0 times
...
Lamar
22 days ago
User 2: No, I believe the correct answer is B) db.posts.createIndex({'comments.author':1}).
upvoted 0 times
...
Chandra
22 days ago
User 2: No, it's actually B) db.posts.createIndex({^comments.author\' :1});
upvoted 0 times
...
Gennie
1 months ago
User 1: I think the correct answer is A) db.posts.createIndex({^comments.$.author\':-1});
upvoted 0 times
...
Isaiah
1 months ago
User 1: I think the correct answer is A) db.posts.createIndex({'comments.$.author':-1}).
upvoted 0 times
...
...
Rosalyn
3 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
3 months ago
User2: I think it might be B) db. posts.createIndex({^comments.author\' :1}).
upvoted 0 times
...
Tricia
3 months ago
User1: I agree with you, A) db.posts.createIndex({^comments.$.author\':-1}) looks like the correct command.
upvoted 0 times
...
...
Susana
3 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
3 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
Odelia
2 months ago
Yes, the correct answer is B. It creates an index on the 'author' field of the 'comments' subdocument.
upvoted 0 times
...
Maira
2 months ago
Oh, I see. Thanks for clarifying. I was confused between A and B.
upvoted 0 times
...
Brittni
2 months ago
No, I believe the correct answer is B) db.posts.createIndex({^comments.author\' :1});
upvoted 0 times
...
Kassandra
3 months ago
I think the answer is A) db.posts.createIndex({^comments.$.author\':-1});
upvoted 0 times
...
...
Marshall
3 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
3 months ago
I think the correct command is B) db.posts.createIndex({^comments.author :1});
upvoted 0 times
...

Save Cancel