Mongodb Certified Developer Associate C100dev · Free Practice Question Easy

Question 24

Suppose you have a developers collection with only two documents:



Using Aggregation Framework you run the following stage:



How many documents will you have in the pipeline after the $unwind stage?

  • A

    4

  • B

    2

  • C

    9

  • D

    5

Reveal correct answer

Correct answer: C

A.

It only accounts for the tech_stack elements in one of the documents. The correct total is 9, considering both documents.

B.

$unwind does not preserve the original number of documents. Instead, it creates one document per element in the array, leading to more documents than originally present.

C.

The $unwind stage deconstructs the tech_stack array in each document, creating a separate document for each element in the array. The first document has 4 elements, and the second has 5, resulting in a total of 9 documents in the pipeline after the $unwind stage.

D.

It only considers the tech_stack elements from one document. The total number of documents after unwinding all arrays in both documents is 9.

Discussion

Think the marked answer is wrong, or have a better explanation? Share it below — comments appear after review.

You must be logged in to post a comment.

Preparing For

Your Certification?

255+ certifications
Detailed explanations
Free PDF samples

Has All The Questions You Need