Preview & Explain
Explains the difference between previewing the DSL query/pipeline before execution and requesting the actual MongoDB execution plan with explain.
preview()
preview() renders the current DSL into a diagnostic Document without executing the query on MongoDB. It is an API to check the build result, not the actual execution plan.
• classic findAll, find, count, exists, distinct
• root aggregation()
• Atlas Search findAll/find/count/existsQuery
• Vector Search findAll/find/count/existsQuery
explain()
explain() executes the actual MongoDB Driver explain operation, so a database connection is required.
You can pass ExplainVerbosity values like QUERY_PLANNER, EXECUTION_STATS, ALL_PLANS_EXECUTIONS directly from the Driver.