nerdexam
MongoDB

C100DBA · Question #22

C100DBA Question #22: Real Exam Question with Answer & Explanation

The correct answer is D. db.posts.find({author:"Tom">,{tags:{$slice:2»). See the full explanation below for the reasoning.

Question

Consider the following posts document: Which of the following queries will return the documents but with only the first two tags in the tags array?

Exhibit

C100DBA question #22 exhibit

Options

  • Adb.posts.find({author:"Tom"».limit({tags:2})
  • Bdb.posts.find({author:"Tom"».limit($slice:{tags:2>)
  • Ddb.posts.find({author:"Tom">,{tags:{$slice:2»)

Community Discussion

No community discussion yet for this question.

Full C100DBA Practice