ExportXMLWordPrintableJSON

    • Type: Epic
    • Resolution: Unresolved
    • Priority: Major - P3
    • 10.1.0, 11.0.0, 9.2.0, 8.5.0
    • Affects Version/s: None
    • Component/s: None
    • None
    • Native LINQ query provider (ground-up rebuild)
    • Dotnet Drivers
    • Not Needed
    • Transparent to users
    • In Progress
    • 0
    • 0
    • 0
    • 🟒 On Track
    • Hide

      Native LINQ for the MongoDB EF Core Provider

      Headline: native EF LINQ is about 33% faster with 68% less memory than today's wrapped driver path, and up to 6Γ— faster on common queries. It is about as fast as the raw driver, and often faster, while being a full ODM.

      The problem. Until now the provider has run queries by handing them to the MongoDB C# driver's own LINQ provider. That got v1 to GA quickly. But it is slow and uses a lot of memory, and it needs the driver to understand EF Core semantics. Writing an EF Core LINQ provider from scratch would normally take person-years of skilled work.

      The project. Arthur Vickers used Claude Code to build a first-class ("native") EF Core LINQ provider for MongoDB. The driver is now used only for low-level database access. The provider itself handles LINQ translation to MQL, BSON rendering and object materialization.

      Architecture.

      • Compile time (once per query shape, cached by EF): preprocess β†’ translate LINQ to a logical IR β†’ postprocess the projection.
      • Gate: ClassifyNativeDisposition decides which path a query takes, under the rule "decline, never guess."
      • Native path: lower to aggregation stages ($match, $lookup, $project), render a BSON template with parameter placeholders, and compile a one-pass shaper that streams straight off the cursor.
      • Fallback path: the previous driver-LINQ path with its DOM-based shaper.
      • Every execution: bind parameters into a clone of the template, let the driver run the aggregate, and materialize objects directly from the cursor.

      How it was built.

      • A feasibility spike with benchmarks came first. It said yes to a native provider but no to dropping the driver entirely.
      • Next came a detailed plan split into ten sub-projects, built using sub-agents. This top-down, "waterfall" approach slipped after a few weeks: scope crept and an agent notes file grew to 594 KB. A reset followed that filed more than 100 issues and ran the rest of the work in a Scrum-like way.
      • At the peak, 3–6 top-level agents worked in parallel. Repeated reviews by fresh-context agents in specific areas (13 specialized reviewers) ran until they found only nits, followed by passes to tighten up code quality.

      Size and status.

      • The PR is about +160K / βˆ’10K lines. About 70% of the added lines are tests (β‰ˆ115K test, β‰ˆ45K product).
      • Thousands of EF spec tests and thousands of new functional tests pass.
      • A reviewer guide (docs/native-query-reviewer-guide.md) ships with the PR.
      • The PR is not yet merged. Human review remains the bottleneck.
      • AI estimates the work at about 200 person-weeks of human effort. The human time spent was about 8 person-weeks.

      Performance summary

      Benchmarks cover 70+ query shapes and compare three paths: the raw driver alone, EF on the wrapped driver LINQ, and EF native LINQ. Both execution time and allocations were measured.

      Native vs. wrapped driver LINQ (78 queries, async rows excluded):

      β”‚ β”‚ Typical query β”‚ Breadth β”‚ Best cases β”‚ Time β”‚ 33% faster β”‚ faster in 77 of 78 β”‚ ProjectOwnedCollectionSelect 6.2Γ— (268β†’43 ms); ProjectOwnedReference 4.8Γ—; MediumWholeEntity 2.7Γ— β”‚
      β”‚ Memory β”‚ 68% less β”‚ less in 78 of 78 β”‚ ProjectOwnedCollectionSelect 25.4Γ— less (110β†’4.3 MB); ProjectOwnedReference 13.1Γ—; WideWholeEntity 12.9Γ— (348β†’27 MB) β”‚

      Native vs. driver alone (73 queries, tracking rows excluded):

      β”‚ β”‚ Typical query β”‚ Notes β”‚ Time β”‚ 13% faster (87% of the raw driver's time) β”‚ Range is 43% (GroupByJoinedKey, ExplicitJoin) to 108% (ProjectJoinedEntity). Simple filter, paging and by-ID queries are at parity. β”‚
      β”‚ Memory β”‚ 49% less β”‚ None of the 73 use more than 25% more. GroupBy shapes do best (e.g. GroupByOwnedHighCardinality uses 15% of the driver's memory).

      Show
      Native LINQ for the MongoDB EF Core Provider Headline: native EF LINQ is about 33% faster with 68% less memory than today's wrapped driver path, and up to 6Γ— faster on common queries. It is about as fast as the raw driver, and often faster, while being a full ODM. The problem. Until now the provider has run queries by handing them to the MongoDB C# driver's own LINQ provider. That got v1 to GA quickly. But it is slow and uses a lot of memory, and it needs the driver to understand EF Core semantics. Writing an EF Core LINQ provider from scratch would normally take person-years of skilled work. The project. Arthur Vickers used Claude Code to build a first-class ("native") EF Core LINQ provider for MongoDB. The driver is now used only for low-level database access. The provider itself handles LINQ translation to MQL, BSON rendering and object materialization. Architecture. Compile time (once per query shape, cached by EF): preprocess β†’ translate LINQ to a logical IR β†’ postprocess the projection. Gate: ClassifyNativeDisposition decides which path a query takes, under the rule "decline, never guess." Native path: lower to aggregation stages ($match, $lookup, $project), render a BSON template with parameter placeholders, and compile a one-pass shaper that streams straight off the cursor. Fallback path: the previous driver-LINQ path with its DOM-based shaper. Every execution: bind parameters into a clone of the template, let the driver run the aggregate, and materialize objects directly from the cursor. How it was built. A feasibility spike with benchmarks came first. It said yes to a native provider but no to dropping the driver entirely. Next came a detailed plan split into ten sub-projects, built using sub-agents. This top-down, "waterfall" approach slipped after a few weeks: scope crept and an agent notes file grew to 594 KB. A reset followed that filed more than 100 issues and ran the rest of the work in a Scrum-like way. At the peak, 3–6 top-level agents worked in parallel. Repeated reviews by fresh-context agents in specific areas (13 specialized reviewers) ran until they found only nits, followed by passes to tighten up code quality. Size and status. The PR is about +160K / βˆ’10K lines. About 70% of the added lines are tests (β‰ˆ115K test, β‰ˆ45K product). Thousands of EF spec tests and thousands of new functional tests pass. A reviewer guide (docs/native-query-reviewer-guide.md) ships with the PR. The PR is not yet merged. Human review remains the bottleneck. AI estimates the work at about 200 person-weeks of human effort. The human time spent was about 8 person-weeks. Performance summary Benchmarks cover 70+ query shapes and compare three paths: the raw driver alone, EF on the wrapped driver LINQ, and EF native LINQ. Both execution time and allocations were measured. Native vs. wrapped driver LINQ (78 queries, async rows excluded): β”‚ β”‚ Typical query β”‚ Breadth β”‚ Best cases β”‚ Time β”‚ 33% faster β”‚ faster in 77 of 78 β”‚ ProjectOwnedCollectionSelect 6.2Γ— (268β†’43 ms); ProjectOwnedReference 4.8Γ—; MediumWholeEntity 2.7Γ— β”‚ β”‚ Memory β”‚ 68% less β”‚ less in 78 of 78 β”‚ ProjectOwnedCollectionSelect 25.4Γ— less (110β†’4.3 MB); ProjectOwnedReference 13.1Γ—; WideWholeEntity 12.9Γ— (348β†’27 MB) β”‚ Native vs. driver alone (73 queries, tracking rows excluded): β”‚ β”‚ Typical query β”‚ Notes β”‚ Time β”‚ 13% faster (87% of the raw driver's time) β”‚ Range is 43% (GroupByJoinedKey, ExplicitJoin) to 108% (ProjectJoinedEntity). Simple filter, paging and by-ID queries are at parity. β”‚ β”‚ Memory β”‚ 49% less β”‚ None of the 73 use more than 25% more. GroupBy shapes do best (e.g. GroupByOwnedHighCardinality uses 15% of the driver's memory).
    • Hide

      2026-12-01 - 🟒 On Track
      Native LINQ for the MongoDB EF Core Provider

      Headline: native EF LINQ is about 33% faster with 68% less memory than today's wrapped driver path, and up to 6Γ— faster on common queries. It is about as fast as the raw driver, and often faster, while being a full ODM.

      The problem. Until now the provider has run queries by handing them to the MongoDB C# driver's own LINQ provider. That got v1 to GA quickly. But it is slow and uses a lot of memory, and it needs the driver to understand EF Core semantics. Writing an EF Core LINQ provider from scratch would normally take person-years of skilled work.

      The project. Arthur Vickers used Claude Code to build a first-class ("native") EF Core LINQ provider for MongoDB. The driver is now used only for low-level database access. The provider itself handles LINQ translation to MQL, BSON rendering and object materialization.

      Architecture.

      • Compile time (once per query shape, cached by EF): preprocess β†’ translate LINQ to a logical IR β†’ postprocess the projection.
      • Gate: ClassifyNativeDisposition decides which path a query takes, under the rule "decline, never guess."
      • Native path: lower to aggregation stages ($match, $lookup, $project), render a BSON template with parameter placeholders, and compile a one-pass shaper that streams straight off the cursor.
      • Fallback path: the previous driver-LINQ path with its DOM-based shaper.
      • Every execution: bind parameters into a clone of the template, let the driver run the aggregate, and materialize objects directly from the cursor.

      How it was built.

      • A feasibility spike with benchmarks came first. It said yes to a native provider but no to dropping the driver entirely.
      • Next came a detailed plan split into ten sub-projects, built using sub-agents. This top-down, "waterfall" approach slipped after a few weeks: scope crept and an agent notes file grew to 594 KB. A reset followed that filed more than 100 issues and ran the rest of the work in a Scrum-like way.
      • At the peak, 3–6 top-level agents worked in parallel. Repeated reviews by fresh-context agents in specific areas (13 specialized reviewers) ran until they found only nits, followed by passes to tighten up code quality.

      Size and status.

      • The PR is about +160K / βˆ’10K lines. About 70% of the added lines are tests (β‰ˆ115K test, β‰ˆ45K product).
      • Thousands of EF spec tests and thousands of new functional tests pass.
      • A reviewer guide (docs/native-query-reviewer-guide.md) ships with the PR.
      • The PR is not yet merged. Human review remains the bottleneck.
      • AI estimates the work at about 200 person-weeks of human effort. The human time spent was about 8 person-weeks.

      Performance summary

      Benchmarks cover 70+ query shapes and compare three paths: the raw driver alone, EF on the wrapped driver LINQ, and EF native LINQ. Both execution time and allocations were measured.

      Native vs. wrapped driver LINQ (78 queries, async rows excluded):

      β”‚ β”‚ Typical query β”‚ Breadth β”‚ Best cases β”‚ Time β”‚ 33% faster β”‚ faster in 77 of 78 β”‚ ProjectOwnedCollectionSelect 6.2Γ— (268β†’43 ms); ProjectOwnedReference 4.8Γ—; MediumWholeEntity 2.7Γ— β”‚
      β”‚ Memory β”‚ 68% less β”‚ less in 78 of 78 β”‚ ProjectOwnedCollectionSelect 25.4Γ— less (110β†’4.3 MB); ProjectOwnedReference 13.1Γ—; WideWholeEntity 12.9Γ— (348β†’27 MB) β”‚

      Native vs. driver alone (73 queries, tracking rows excluded):

      β”‚ β”‚ Typical query β”‚ Notes β”‚ Time β”‚ 13% faster (87% of the raw driver's time) β”‚ Range is 43% (GroupByJoinedKey, ExplicitJoin) to 108% (ProjectJoinedEntity). Simple filter, paging and by-ID queries are at parity. β”‚
      β”‚ Memory β”‚ 49% less β”‚ None of the 73 use more than 25% more. GroupBy shapes do best (e.g. GroupByOwnedHighCardinality uses 15% of the driver's memory).


      2026-12-01 - No confidence status provided
      Native LINQ for the MongoDB EF Core Provider

      Headline: native EF LINQ is about 33% faster with 68% less memory than today's wrapped driver path, and up to 6Γ— faster on common queries. It is about as fast as the raw driver, and often faster, while being a full ODM.

      The problem. Until now the provider has run queries by handing them to the MongoDB C# driver's own LINQ provider. That got v1 to GA quickly. But it is slow and uses a lot of memory, and it needs the driver to understand EF Core semantics. Writing an EF Core LINQ provider from scratch would normally take person-years of skilled work.

      The project. Arthur Vickers used Claude Code to build a first-class ("native") EF Core LINQ provider for MongoDB. The driver is now used only for low-level database access. The provider itself handles LINQ translation to MQL, BSON rendering and object materialization.

      Architecture.

      • Compile time (once per query shape, cached by EF): preprocess β†’ translate LINQ to a logical IR β†’ postprocess the projection.
      • Gate: ClassifyNativeDisposition decides which path a query takes, under the rule "decline, never guess."
      • Native path: lower to aggregation stages ($match, $lookup, $project), render a BSON template with parameter placeholders, and compile a one-pass shaper that streams straight off the cursor.
      • Fallback path: the previous driver-LINQ path with its DOM-based shaper.
      • Every execution: bind parameters into a clone of the template, let the driver run the aggregate, and materialize objects directly from the cursor.

      How it was built.

      • A feasibility spike with benchmarks came first. It said yes to a native provider but no to dropping the driver entirely.
      • Next came a detailed plan split into ten sub-projects, built using sub-agents. This top-down, "waterfall" approach slipped after a few weeks: scope crept and an agent notes file grew to 594 KB. A reset followed that filed more than 100 issues and ran the rest of the work in a Scrum-like way.
      • At the peak, 3–6 top-level agents worked in parallel. Repeated reviews by fresh-context agents in specific areas (13 specialized reviewers) ran until they found only nits, followed by passes to tighten up code quality.

      Size and status.

      • The PR is about +160K / βˆ’10K lines. About 70% of the added lines are tests (β‰ˆ115K test, β‰ˆ45K product).
      • Thousands of EF spec tests and thousands of new functional tests pass.
      • A reviewer guide (docs/native-query-reviewer-guide.md) ships with the PR.
      • The PR is not yet merged. Human review remains the bottleneck.
      • AI estimates the work at about 200 person-weeks of human effort. The human time spent was about 8 person-weeks.

      Performance summary

      Benchmarks cover 70+ query shapes and compare three paths: the raw driver alone, EF on the wrapped driver LINQ, and EF native LINQ. Both execution time and allocations were measured.

      Native vs. wrapped driver LINQ (78 queries, async rows excluded):

      β”‚ β”‚ Typical query β”‚ Breadth β”‚ Best cases β”‚ Time β”‚ 33% faster β”‚ faster in 77 of 78 β”‚ ProjectOwnedCollectionSelect 6.2Γ— (268β†’43 ms); ProjectOwnedReference 4.8Γ—; MediumWholeEntity 2.7Γ— β”‚
      β”‚ Memory β”‚ 68% less β”‚ less in 78 of 78 β”‚ ProjectOwnedCollectionSelect 25.4Γ— less (110β†’4.3 MB); ProjectOwnedReference 13.1Γ—; WideWholeEntity 12.9Γ— (348β†’27 MB) β”‚

      Native vs. driver alone (73 queries, tracking rows excluded):

      β”‚ β”‚ Typical query β”‚ Notes β”‚ Time β”‚ 13% faster (87% of the raw driver's time) β”‚ Range is 43% (GroupByJoinedKey, ExplicitJoin) to 108% (ProjectJoinedEntity). Simple filter, paging and by-ID queries are at parity. β”‚
      β”‚ Memory β”‚ 49% less β”‚ None of the 73 use more than 25% more. GroupBy shapes do best (e.g. GroupByOwnedHighCardinality uses 15% of the driver's memory).


      2026-11-26 - No confidence status provided
      Initial implementation is complete. All queries we have tests for that previously passed with the driver-based LINQ now pass with native LINQ. Perf is much improved. For more information, see https://www.youtube.com/watch?v=2RuFKqSVV88

      There is no known delivery date. That depends on code review, which is out of my hands.


      2026-07-29 - No confidence status provided
      No project update provided


      Show
      2026-12-01 - 🟒 On Track Native LINQ for the MongoDB EF Core Provider Headline: native EF LINQ is about 33% faster with 68% less memory than today's wrapped driver path, and up to 6Γ— faster on common queries. It is about as fast as the raw driver, and often faster, while being a full ODM. The problem. Until now the provider has run queries by handing them to the MongoDB C# driver's own LINQ provider. That got v1 to GA quickly. But it is slow and uses a lot of memory, and it needs the driver to understand EF Core semantics. Writing an EF Core LINQ provider from scratch would normally take person-years of skilled work. The project. Arthur Vickers used Claude Code to build a first-class ("native") EF Core LINQ provider for MongoDB. The driver is now used only for low-level database access. The provider itself handles LINQ translation to MQL, BSON rendering and object materialization. Architecture. Compile time (once per query shape, cached by EF): preprocess β†’ translate LINQ to a logical IR β†’ postprocess the projection. Gate: ClassifyNativeDisposition decides which path a query takes, under the rule "decline, never guess." Native path: lower to aggregation stages ($match, $lookup, $project), render a BSON template with parameter placeholders, and compile a one-pass shaper that streams straight off the cursor. Fallback path: the previous driver-LINQ path with its DOM-based shaper. Every execution: bind parameters into a clone of the template, let the driver run the aggregate, and materialize objects directly from the cursor. How it was built. A feasibility spike with benchmarks came first. It said yes to a native provider but no to dropping the driver entirely. Next came a detailed plan split into ten sub-projects, built using sub-agents. This top-down, "waterfall" approach slipped after a few weeks: scope crept and an agent notes file grew to 594 KB. A reset followed that filed more than 100 issues and ran the rest of the work in a Scrum-like way. At the peak, 3–6 top-level agents worked in parallel. Repeated reviews by fresh-context agents in specific areas (13 specialized reviewers) ran until they found only nits, followed by passes to tighten up code quality. Size and status. The PR is about +160K / βˆ’10K lines. About 70% of the added lines are tests (β‰ˆ115K test, β‰ˆ45K product). Thousands of EF spec tests and thousands of new functional tests pass. A reviewer guide (docs/native-query-reviewer-guide.md) ships with the PR. The PR is not yet merged. Human review remains the bottleneck. AI estimates the work at about 200 person-weeks of human effort. The human time spent was about 8 person-weeks. Performance summary Benchmarks cover 70+ query shapes and compare three paths: the raw driver alone, EF on the wrapped driver LINQ, and EF native LINQ. Both execution time and allocations were measured. Native vs. wrapped driver LINQ (78 queries, async rows excluded): β”‚ β”‚ Typical query β”‚ Breadth β”‚ Best cases β”‚ Time β”‚ 33% faster β”‚ faster in 77 of 78 β”‚ ProjectOwnedCollectionSelect 6.2Γ— (268β†’43 ms); ProjectOwnedReference 4.8Γ—; MediumWholeEntity 2.7Γ— β”‚ β”‚ Memory β”‚ 68% less β”‚ less in 78 of 78 β”‚ ProjectOwnedCollectionSelect 25.4Γ— less (110β†’4.3 MB); ProjectOwnedReference 13.1Γ—; WideWholeEntity 12.9Γ— (348β†’27 MB) β”‚ Native vs. driver alone (73 queries, tracking rows excluded): β”‚ β”‚ Typical query β”‚ Notes β”‚ Time β”‚ 13% faster (87% of the raw driver's time) β”‚ Range is 43% (GroupByJoinedKey, ExplicitJoin) to 108% (ProjectJoinedEntity). Simple filter, paging and by-ID queries are at parity. β”‚ β”‚ Memory β”‚ 49% less β”‚ None of the 73 use more than 25% more. GroupBy shapes do best (e.g. GroupByOwnedHighCardinality uses 15% of the driver's memory). 2026-12-01 - No confidence status provided Native LINQ for the MongoDB EF Core Provider Headline: native EF LINQ is about 33% faster with 68% less memory than today's wrapped driver path, and up to 6Γ— faster on common queries. It is about as fast as the raw driver, and often faster, while being a full ODM. The problem. Until now the provider has run queries by handing them to the MongoDB C# driver's own LINQ provider. That got v1 to GA quickly. But it is slow and uses a lot of memory, and it needs the driver to understand EF Core semantics. Writing an EF Core LINQ provider from scratch would normally take person-years of skilled work. The project. Arthur Vickers used Claude Code to build a first-class ("native") EF Core LINQ provider for MongoDB. The driver is now used only for low-level database access. The provider itself handles LINQ translation to MQL, BSON rendering and object materialization. Architecture. Compile time (once per query shape, cached by EF): preprocess β†’ translate LINQ to a logical IR β†’ postprocess the projection. Gate: ClassifyNativeDisposition decides which path a query takes, under the rule "decline, never guess." Native path: lower to aggregation stages ($match, $lookup, $project), render a BSON template with parameter placeholders, and compile a one-pass shaper that streams straight off the cursor. Fallback path: the previous driver-LINQ path with its DOM-based shaper. Every execution: bind parameters into a clone of the template, let the driver run the aggregate, and materialize objects directly from the cursor. How it was built. A feasibility spike with benchmarks came first. It said yes to a native provider but no to dropping the driver entirely. Next came a detailed plan split into ten sub-projects, built using sub-agents. This top-down, "waterfall" approach slipped after a few weeks: scope crept and an agent notes file grew to 594 KB. A reset followed that filed more than 100 issues and ran the rest of the work in a Scrum-like way. At the peak, 3–6 top-level agents worked in parallel. Repeated reviews by fresh-context agents in specific areas (13 specialized reviewers) ran until they found only nits, followed by passes to tighten up code quality. Size and status. The PR is about +160K / βˆ’10K lines. About 70% of the added lines are tests (β‰ˆ115K test, β‰ˆ45K product). Thousands of EF spec tests and thousands of new functional tests pass. A reviewer guide (docs/native-query-reviewer-guide.md) ships with the PR. The PR is not yet merged. Human review remains the bottleneck. AI estimates the work at about 200 person-weeks of human effort. The human time spent was about 8 person-weeks. Performance summary Benchmarks cover 70+ query shapes and compare three paths: the raw driver alone, EF on the wrapped driver LINQ, and EF native LINQ. Both execution time and allocations were measured. Native vs. wrapped driver LINQ (78 queries, async rows excluded): β”‚ β”‚ Typical query β”‚ Breadth β”‚ Best cases β”‚ Time β”‚ 33% faster β”‚ faster in 77 of 78 β”‚ ProjectOwnedCollectionSelect 6.2Γ— (268β†’43 ms); ProjectOwnedReference 4.8Γ—; MediumWholeEntity 2.7Γ— β”‚ β”‚ Memory β”‚ 68% less β”‚ less in 78 of 78 β”‚ ProjectOwnedCollectionSelect 25.4Γ— less (110β†’4.3 MB); ProjectOwnedReference 13.1Γ—; WideWholeEntity 12.9Γ— (348β†’27 MB) β”‚ Native vs. driver alone (73 queries, tracking rows excluded): β”‚ β”‚ Typical query β”‚ Notes β”‚ Time β”‚ 13% faster (87% of the raw driver's time) β”‚ Range is 43% (GroupByJoinedKey, ExplicitJoin) to 108% (ProjectJoinedEntity). Simple filter, paging and by-ID queries are at parity. β”‚ β”‚ Memory β”‚ 49% less β”‚ None of the 73 use more than 25% more. GroupBy shapes do best (e.g. GroupByOwnedHighCardinality uses 15% of the driver's memory). 2026-11-26 - No confidence status provided Initial implementation is complete. All queries we have tests for that previously passed with the driver-based LINQ now pass with native LINQ. Perf is much improved. For more information, see https://www.youtube.com/watch?v=2RuFKqSVV88 There is no known delivery date. That depends on code review, which is out of my hands. 2026-07-29 - No confidence status provided No project update provided
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Ground-up native LINQ query provider for the MongoDB EF Core provider.

      What we are doing

      Replace the translation half of the Query subsystem. The provider will build MongoDB aggregation pipelines (MQL) itself from a canonical query AST and use the C# driver only to execute them (BSON, cursors, sessions, transactions) β€” the driver's LINQ provider is no longer the translation engine. Keep the streaming materializer and the test/benchmark rig; delete the driver-LINQ delegation once native reaches parity.

      Architecture: a Mongo query AST β†’ typed stage IR β†’ BsonDocument[] pipeline, built once at compile time and parameter-bound per execution. Pipeline choice is a user-level DbContext config option (Native default / DriverLinq revert / NativeStrict diagnostic) β€” no environment variables, so a user who hits a regression can switch back to the legacy pipeline. Materialization endgame: read stream β†’ POCO in one pass, with no intermediate BSON objects and no double copy.

      Why

      Performance (N=10k):

      Shape Current provider Native
      Where→ToList 15.1 ms / 22.7 MB 8.3 ms / 9.6 MB
      Whole-entity (no-track) 33.4 ms / 45.3 MB 15.6 ms / 19.1 MB
      Reference Include 138.3 ms / 52.0 MB 114.7 ms / 22.3 MB

      ~50% less allocation and ~45–53% faster on allocation-heavy reads.

      Conformance ceiling. The driver's LINQ provider lacks operators and was not built to EF Core semantics, so a class of spec tests cannot pass while we delegate to it β€” and cannot be fixed without owning translation. Owning it lowers the limit to "what MongoDB can express," the only limit worth having.

      Delivery (sub-projects, each at zero regressions with driver-LINQ as the fallback)

      1. AST foundation β€” filter / sort / paging + single-level reference Include. (designed, ready to plan)
      2. Predicate breadth β€” the $expr renderer and the operator long tail.
      3. Projection pushdown β€” server-side $project.
      4. Scalar cardinality β€” Count / First / Any / aggregates.
      5. Collection Includes β€” collection / nested / filtered.
      6. Remaining operators β€” GroupBy, SelectMany, set ops, Distinct, OfType, VectorSearch, non-canonical paging.
      7. Materializer perf β€” one-pass stream β†’ POCO (no per-row BSON object).

      At parity: retire the driver-LINQ fallback and delete the delegation code.

      References

      Design docs (on the feature branch, off main):

      • docs/superpowers/specs/2026-06-23-native-query-provider-overview.md β€” terse overview / review entry point
      • docs/superpowers/specs/2026-06-23-native-query-provider-design.md β€” full design
      • docs/superpowers/specs/2026-06-20-mongo-query-ast-foundation-design.md β€” sub-project 1 detail

      Spike reference (proof-of-concept, not merged): branch spike/low-level-provider.

      Success metric: EF Core spec conformance. Per sub-project: zero regressions, native coverage must not shrink, benchmarks β‰₯ spike.

            Assignee:
            Arthur Vickers
            Reporter:
            Arthur Vickers
            None
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              23 weeks, 3 days
              None
              None