Courseiva
CRUD Operations →mediumMultiple Choice

C100DBA CRUD Operations Practice Question

What is the result of applying a $push operator with a value of [1, 2] to an existing array field [0]?

⚠ Common exam trap

Developers often assume the $push operator automatically flattens arrays, mistakenly expecting [0] plus [1, 2] to result in [0, 1, 2] instead of a nested array structure.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

✓

[0, [1, 2]]

The $push operator adds the specified value to the end of the array. If the value itself is an array, $push adds that array as a single element, resulting in a nested structure. If the goal was to append individual elements, the $each modifier should be used with $push. This distinction is critical for developers managing arrays to ensure the resulting data shape matches the application's expected schema.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • ✗

    [0, 1, 2]

    Why it's wrong here

    This result would only occur if the $each modifier was used to unpack the input array elements into the existing array. Without $each, $push treats the input as a single object to be added, resulting in a nested array rather than a flattened list of integers.

  • ✓

    [0, [1, 2]]

    Why this is correct

    The $push operator adds the entire input object as a single new element. Since the input is an array [1, 2], the resulting array contains the original elements plus the new nested array at the end. This is standard behavior for $push when adding complex objects.

  • ✗

    [1, 2]

    Why it's wrong here

    The $push operator does not replace the existing array. Instead, it appends the new data to the existing content. Replacing the array would require using the $set operator, which would overwrite the original data, potentially leading to data loss if not intended by the application logic.

  • ✗

    Error

    Why it's wrong here

    Adding an array to an array using $push is a valid operation in MongoDB. There are no syntax or type errors in this command. MongoDB handles nested arrays gracefully, allowing for complex data structures that can be queried and updated using standard operators and aggregation framework tools.

About these practice questions

Courseiva writes every C100DBA question from scratch — 222 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written and reviewed by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

Last reviewed September 2026 · checked against the official MongoDB exam blueprint

This C100DBA practice question is part of Courseiva's free MongoDB certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the C100DBA exam.