Extension $search does not enforce the timeseries ban for a $lookup targeting a search view defined over a timeseries collection

XMLWordPrintableJSON

    • Query Integration
    • Fully Compatible
    • ALL
    • v9.0
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Problem

      When featureFlagSearchExtension is enabled (i.e. $search/$searchMeta run through the Extensions API), the server fails to enforce the "search is unsupported on timeseries collections" ban for an aggregation whose $lookup targets a search view defined over a timeseries collection. The command that should fail with Location12093200 instead returns ok: 1 with results.

      With the legacy (non-extension) $search implementation the same command is correctly rejected, so this is a gap specific to the extension code path.

      Environment / Repro

      • Suite: with_mongot_extension_vectorSearch_disabled_single_node (flags: featureFlagSearchExtension: true, featureFlagVectorSearchExtension: false, featureFlagExtensionsInsideHybridSearch: true).
      • Test: { Unknown macro: \{jstests/with_mongot/e2e/search_disallowed_on_timeseries.js}

        }

      • Topology: single node (not sharding-specific).

      The test builds a search view over a timeseries collection and asserts, via assert.commandFailedWithCode(...), that queries touching it are rejected. Most variants are correctly rejected; the leaking case is a $lookup whose from is the search-view-over-timeseries:

      db.non_tscoll.aggregate([
        {
          $lookup: {
            from: "searchview_search_disallowed_on_timeseries",   // view defined with $search over a timeseries collection
            let: \{ lkey: "$key" },
            pipeline: [ \{ $match: { $expr: { $eq: [ "$tags", "$$lkey" ] } } } ],
            as: "joined"
          }
        }
      ])
      

      Expected vs Actual

      • Expected: command fails with Location12093200 ("$_internalSearchIdLookup is unsupported for timeseries collections"), as it does with legacy $search.
      • Actual: command returns ok: 1 with populated joined arrays. The JS assertion fails with "command worked when it should have failed".

      For comparison, direct extension $search/$searchMeta/$vectorSearch on the timeseries collection or view are correctly rejected (e.g. Location12093200, Location10557302) — only the $lookup-into-a-search-view-over-timeseries path leaks.

      Impact

      • An unsupported search-on-timeseries query silently executes instead of being rejected, producing results the engine does not intend to support.
      • Behavioral divergence between the legacy and extension $search paths.

      Notes

      • Currently excluded via buildscripts/resmokeconfig/matrix_suites/overrides/with_mongot_extension.yml (exclude_search_extension_incompatible) with a placeholder TODO pointing at this ticket.
      • Related files: src/mongo/db/extension/host/document_source_extension_optimizable.cpp (extension view/timeseries validation), src/mongo/db/pipeline/document_source_lookup.cpp (subpipeline view resolution).

            Assignee:
            Will Buerger
            Reporter:
            Finley Lau
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: