Native query: Mongo query AST foundation (filter/sort/paging + single-level reference Include)

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Unresolved
    • Priority: Unknown
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Dotnet Drivers
    • Not Needed
    • None
    • None
    • None
    • None
    • None
    • None

      Sub-project 1 of the native LINQ query provider rebuild (epic EF-322): replace the translation half of the Query subsystem with a real query AST + pipeline generator, at parity with what the spike already runs natively.

      Scope

      • In: single-collection filter ($match), sort ($sort), paging ($skip/$limit), single-level reference Include ($lookup/$unwind); whole-entity results.
      • Out (later sub-projects): predicate breadth / $expr, projection pushdown, scalar cardinality, collection / nested / filtered Includes, GroupBy / SelectMany / set ops / Distinct / OfType / VectorSearch, non-canonical paging, the per-row double-pass materializer fix.

      Approach

      • AST model A3 (hybrid): logical-slot MongoSelectExpression → typed MongoStage[] IR → BsonDocument[].
      • Pipeline generation B2: lower/render once at compile time into a cached factory; bind parameters per execution. The native-vs-driver decision moves to compile time (deterministic), replacing the spike's per-execution try/catch.
      • The QMTEV populates AST slots where it returns null today (Where/OrderBy/Skip/Take). Driver-LINQ stays the gated fallback; Include is kept as-is, with its clean-up deferred to the collection-Includes sub-project.
      • Kept unchanged: streaming materializer, DOM shaper, query-mode config option, test/benchmark rig. Superseded: MongoPipelineTranslator / MongoPredicateTranslator.

      Acceptance

      • Zero regressions: full FunctionalTests + SpecificationTests green in Native mode on EF10 and EF8.
      • Strict-mode native coverage must not shrink vs the spike (~64% spec / ~82% functional Query).
      • New unit tests for slot population + rendered MQL, including parameterized-binding correctness across executions.
      • Benchmark headline re-run ≥ spike.

      Design docs

      • 2026-06-20-mongo-query-ast-foundation-overview.md — terse what / why
      • 2026-06-20-mongo-query-ast-foundation-design.md — full design
      • Program: 2026-06-23-native-query-provider-design.md (on the EF-322 program branch/PR).

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

              Created:
              Updated: