Quick Answer
Plan cache eviction happens when: the collection's data distribution changes significantly (index stats become stale), the index is dropped, the collection is rebuilt, or MongoDB restarts. After eviction, the planner re-evaluates all candidate plans next time the query runs. Unexpected plan cache evictions can cause sudden performance changes as a previously good plan is reevaluated.
Answer
Plan cache evicts entries after metadata changes or when query patterns deviate significantly, forcing re-evaluation of plans.
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.
MongoDB interview questions and answers for beginner, junior, mid-level, senior, and expert developers. Perfect for freshers and experienced candidates.