MongoDB
C100DBA · Question #29
Consider the following document from the products collection: What does the following query using $elemMatch return? db.products.find( { product_code: "345678" }, { variations: { $elemMatch: { size: ^
Sign in or unlock C100DBA to reveal the answer and full explanation for question #29. The question stem and answer options stay visible for context.
MongoDB Fundamentals
Question
Consider the following document from the products collection:
What does the following query using $elemMatch return? db.products.find( { product_code:
"345678" }, { variations: { $elemMatch: { size: ^L^ } } } )
Exhibit
Options
- AReturns the complete document but retrieves only the size field from the array
- BReturns the document but with only one element in the variations array (corresponding to size L)
- CReturns the complete document since MongoDB does not support partial array retrieval
- DReturns the complete document but retrieves only the size field from the array and also with only
Unlock C100DBA to see the answer
You've previewed enough free C100DBA questions. Unlock C100DBA for full answers, explanations, the timed quiz mode, progress tracking, and the master PDF. Question stem and options stay visible so you can still see what's on the exam.
Topics
#$elemMatch#array projection#find projection#query operators
