<!-- llms-explorer concept facts · https://llms-explorer.com/tree/mongodb-cbr-ce-source-metadata/ · pack 2026-10-31 · ~1138 tokens -->

# MongoDB CBR CE source metadata

> Source-anchored research for MongoDB CBR CE source metadata. Run status: COMPLETED.

Parent: [ceSource cardinality estimation (sampling vs heuristics)](https://llms-explorer.com/tree/cesource-cardinality-estimation-sampling-vs-heuristics/) · 4 facets · 12 facts · page: https://llms-explorer.com/tree/mongodb-cbr-ce-source-metadata/

## Structure and components

- The manual lists lowercase category names, while historical issue output contains capitalized Sampling, Metadata, Heuristics and Histogram. Do not assume the manual list specifies every label emitted by every historical build. (medium confidence) — [source](https://www.mongodb.com/docs/manual/reference/explain-results/)

## How it works

- The explain manual describes sampling as estimating from a base-collection sample and heuristics as rule-based selectivity estimation used when sampling fails. (low confidence) (verified as of 2026-10-24) — [source](https://www.mongodb.com/docs/manual/reference/explain-results/)
- SERVER-128328 describes makeScaledEstimate() returning Code when sample size reaches collection size. Persistent samples invalidate the inference that this necessarily covers the current collection; the requested correction uses Sampling with featureFlagPersistentStats enabled. The issue records resolution Fixed and fix version 9.0.0-rc0. (low confidence) (verified as of 2026-06-22) — [source](https://jira.mongodb.org/browse/SERVER-128328)

## Problems, failure modes and limitations

- estimatesMetadata.ceSource describes cardinality-estimate provenance for an individual stage. Inspect child stages as well: SERVER-121013 demonstrates a LIMIT labeled Metadata above FETCH and IXSCAN stages labeled Sampling. (high confidence) — [source](https://www.mongodb.com/docs/manual/reference/explain-results/)
- SERVER-121013 reports that CBR query-statistics capture inspected only the root CE source, which can misrepresent methods used below it. Its reproducer sets internalQueryCBRCEMode to samplingCE yet shows Metadata at the LIMIT root. (low confidence) — [source](https://jira.mongodb.org/browse/SERVER-121013)

## Facts and statements

- The explain field estimatesMetadata.ceSource identifies the cardinality-estimation method for an individual stage; estimatesMetadata describes how the estimate was derived. (medium confidence) — [source](https://www.mongodb.com/docs/manual/reference/explain-results/)
- The documented metadata category derives estimates from database metadata such as collection cardinality; mixed combines estimates of different types; code denotes a direct C++ calculation such as a constant or expression. (low confidence) (verified as of 2026-10-24) — [source](https://www.mongodb.com/docs/manual/reference/explain-results/)
- SERVER-121013 reports that query-stats CE classification inspected only the root and could misrepresent methods used elsewhere in the tree; the ticket remained unresolved in its April 6, 2026 update. This is a dated report, not proof of behavior in every current release. (low confidence) (verified as of 2026-04-06) — [source](https://jira.mongodb.org/browse/SERVER-121013)
- The manual marks estimatesMetadata.ceSource and cardinalityEstimate as new in 8.3.3. It lists lowercase labels, whereas SERVER-121013 reproduces capitalized Metadata and Sampling; consumers should verify the exact representation for their server build. (medium confidence) (verified as of 2026-10-31) — [source](https://www.mongodb.com/docs/manual/reference/explain-results/)
- The query-stats implementation README separately documents cardinalityEstimationMethods counters and nDocsSampled; aggregate telemetry does not replace inspection of per-stage explain provenance. (medium confidence) — [source](https://github.com/mongodb/mongo/blob/master/src/mongo/db/query/query_stats/README.md)
- Read ceSource beside cardinalityEstimate, which estimates stage output documents or keys, and costEstimate, which represents abstract stage cost. Provenance alone does not certify numerical correctness: SERVER-98094 reports an incorrect estimate bearing a Histogram label. (medium confidence) — [source](https://www.mongodb.com/docs/manual/reference/explain-results/)
- SERVER-100417 supplies historical heuristicCE explain output with estimates on a COLLSCAN child but no costEstimate, cardinalityEstimate or estimatesMetadata on its COUNT parent. Missing root estimates therefore require stage and version investigation. (low confidence) — [source](https://jira.mongodb.org/browse/SERVER-100417)
