NewDocumentDB 1.0 is here. See what's new
MQL reference navigation

explain

Returns planning information for find, aggregate, count, or distinct. The default gateway does not explain write commands.

db.flights.find({ status: "Delayed" }).explain("executionStats")
ParameterDescription
explain(Required) A document specifying the nested read command, with the same options as its command page.
verbosity(Optional) A string selecting queryPlanner (default), executionStats, or allPlansExecution. DocumentDB also recognizes allShardsQueryPlan and allShardsExecution for distributed diagnostics.

allPlansExecution provides detailed execution plans, including cursor-based planning details, alongside execution statistics. Use it to investigate how a cursor query is planned.

Execution-statistics modes execute the underlying read to collect statistics. An unrecognized verbosity string follows the implementation's default mode rather than selecting a new diagnostic mode. aggregate also accepts explain: true directly.

See wire protocol and common fields. Source: gateway explain/mod.rs, process_explain and Verbosity.