Skip to main content

What are yield points during query execution?

Senior MongoDB
Quick Answer Yield points are moments during a long-running query when MongoDB pauses to check for interrupts and allow other operations to run. Without yields, a long collection scan could hold resources indefinitely. MongoDB yields automatically at regular intervals (every 128 documents by default). This prevents any single query from starving other operations, but it means cursors can see changes made during their execution.

Answer

Yield points allow MongoDB to pause long operations to let other operations acquire locks, preventing system stalls.
S
SugharaIQ Editorial Team Verified Answer

This answer has been peer-reviewed by industry experts holding senior engineering roles to ensure technical accuracy and relevance for modern interview standards.

Want to bookmark, take notes, or join discussions?

Sign in to access all features and personalize your learning experience.

Sign In Create Account

Source: SugharaIQ

Ready to level up? Start Practice