Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-70160

Do not push down $match that needs whole document before $internalUnpackBucket

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 5.0.14
    • Affects Version/s: 5.0.13
    • Component/s: None
    • Labels:
      None
    • Fully Compatible
    • ALL
    • 135

      The aggregation with a single $match stage over timeseries

       

      [{"$match" : {"$expr" : {"$getField" : "measurement1"}}}] 
      

       

      is incorrectly pushed before the internalUnpackBucket stage and evaluated to an empty document set.

      This happens in DocumentSource::PushMatchBefore() function where the analysis misses the fact that the $match stage needs the entire document. https://github.com/mongodb/mongo/blob/v5.0/src/mongo/db/pipeline/document_source.cpp#L199

            Assignee:
            milena.ivanova@mongodb.com Milena Ivanova
            Reporter:
            milena.ivanova@mongodb.com Milena Ivanova
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: