MongoDB uses an empirical method for query planning where all viable plans are executed and benchmarked to choose the best performing plan, rather than estimating statistics like traditional databases. If the cached plan's performance decreases beyond a threshold during subsequent queries, it will be evicted and candidate plans re-tested. Several execution metrics are gathered like number of documents retrieved and work units to score each plan and identify the best one. The plan cache can be cleared for a specific query or collection for troubleshooting query performance issues.