C100DEV Aggregation Framework Practice Question
Which operator is used within a $project stage to calculate the square root of a numerical field?
⚠ Common exam trap
Candidates often try to use standard JavaScript Math functions like Math.sqrt() inside the aggregation pipeline, forgetting that MongoDB requires specific aggregation operators like $sqrt to perform calculations.
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
✓
$sqrt
The $sqrt operator is part of the aggregation framework's mathematical expression set. It is specifically designed to compute the square root of a given number or expression. Understanding available mathematical operators allows developers to perform complex calculations directly within the database, minimizing the need to retrieve raw data and process it in the application layer, which improves overall system efficiency.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
$pow
Why it's wrong here
The $pow operator is used to raise a base number to a specified exponent. While related to square roots, it is not the dedicated operator for calculating a square root. Using $pow requires providing the exponent 0.5, whereas $sqrt is the more direct, native, and readable approach.
- ✓
$sqrt
Why this is correct
The $sqrt operator is the standard aggregation function for calculating the square root of a non-negative number. It is highly optimized for performance and is the correct choice for mathematical transformations involving square roots within an aggregation pipeline's $project or $addFields stages.
- ✗
$abs
Why it's wrong here
The $abs operator returns the absolute value of a number. It is useful for normalization or range calculations but does not perform any square root computation. Attempting to use $abs to calculate a square root will result in incorrect numerical outputs, as it ignores the required mathematical power function.
- ✗
$exp
Why it's wrong here
The $exp operator raises Euler's number (e) to the power of a specified number. This is an exponential calculation used for growth modeling or complex mathematical modeling, and it has no functional relationship to calculating the square root of a standard numerical field in a document.
About these practice questions
One of 259 original C100DEV practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →
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 C100DEV 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 C100DEV exam.