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^ } } } )
Suggested Answer: B
Get Premium C100DBA Questions
as Interactive Web-Based Practice Test or PDF
Real Exam Format
Detailed Explanations
Instant Access
Get Your Practice Test
30 comments · newest first
AN
Annita
7 hours ago
I agree, B is the best choice.
MA
Maurine
5 days ago
B is clear and straightforward.
YU
Yuki
11 days ago
D is too much info for one element.
DE
Delpha
16 days ago
C is wrong, it supports partial retrieval.
EV
Eva
21 days ago
But it retrieves size field only.
AN
Annita
26 days ago
A doesn't make sense.
EV
Eva
1 month ago
I feel it's A.
MA
Maurine
1 month ago
It matches size L, so only one variation.
YU
Yuki
1 month ago
Why B?
MA
Maurine
2 months ago
I think it's B.
LI
Lilli
2 months ago
I hope I get this right!
MO
Mozell
2 months ago
Agreed, B makes sense for clarity.
WA
Walton
2 months ago
Still, B is the most straightforward answer.
SE
Serina
2 months ago
But D includes size field retrieval.
LI
Lilli
2 months ago
D is too complicated. Just one element is enough.
JA
Jackie
3 months ago
C seems wrong. It retrieves specific fields.
MO
Mozell
3 months ago
A doesn't limit the array though.
SE
Serina
3 months ago
I feel like it could be A too.
WA
Walton
3 months ago
It matches size L, so only that variation shows up.
JA
Jackie
3 months ago
Why B?
WA
Walton
3 months ago
I think it's B.
DE
Denae
4 months ago
A is misleading, it doesn't just retrieve the size field.
CA
Carry
4 months ago
C is incorrect, it can return specific elements!
TE
Terrilyn
4 months ago
Wait, does MongoDB really not support partial array retrieval?
BO
Bobbye
4 months ago
Definitely B! Makes the most sense.
RE
Rebbeca
4 months ago
I think it returns the document with just one variation for size L.
AU
Audrie
4 months ago
I feel like option D might be the right choice since it mentions retrieving the size field and only one element, which seems to align with how $elemMatch works.
BE
Becky
5 months ago
I’m a bit confused about whether MongoDB allows partial retrieval of arrays. I thought it did, but I could be wrong.
CL
Claribel
5 months ago
I remember practicing a similar question where $elemMatch was used, and it returned only the matching elements from the array. So, I’m leaning towards option B.
DO
Dorathy
5 months ago
I think the query is supposed to return the document with just the matching variation, but I'm not entirely sure if it includes the whole document or just part of it.