C100DEV Aggregation Framework Practice Question
What happens if a $sort stage exceeds the 100MB RAM limit without an index?
⚠ Common exam trap
Many candidates assume MongoDB automatically writes large sort operations to disk, forgetting that the 100MB limit triggers an error unless allowDiskUse is enabled.
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
✓
The pipeline fails with an error.
If an aggregation stage exceeds the memory limit, the operation will fail unless 'allowDiskUse' is explicitly set to true. When enabled, MongoDB writes the data to temporary files on disk to complete the operation. While this allows large sorts to finish, it significantly degrades performance due to disk I/O, which is orders of magnitude slower than in-memory processing, highlighting the importance of proper indexing.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
It automatically uses disk storage.
Why it's wrong here
The database does not automatically switch to disk storage for safety reasons. It will abort the operation and return an error unless the user explicitly opts into disk usage via the 'allowDiskUse' option. This prevents unexpected disk filling if a developer accidentally writes an inefficient pipeline query.
- ✓
The pipeline fails with an error.
Why this is correct
Without the 'allowDiskUse' option, the aggregation framework enforces a strict 100MB limit per stage to protect the system's memory. If a sort operation requires more memory, it aborts the process and throws an error, forcing the user to optimize the pipeline or enable disk usage.
- ✗
The sort is truncated to 100MB.
Why it's wrong here
MongoDB does not truncate data during an aggregation sort. Truncation would lead to incorrect results, which is contrary to the database's guarantee of data integrity. The system will prioritize failing the operation over returning incomplete or inaccurate results from an aggregation pipeline process.
- ✗
The query planner adds an index.
Why it's wrong here
The query planner optimizes based on existing indexes but cannot create new indexes during the execution of an aggregation pipeline. If a sort is causing memory issues, the developer must manually create the appropriate index on the collection to support the sort and avoid the memory bottleneck.
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.