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

Fix serialization of nested $elemMatch's

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 7.1.0-rc0, 7.0.1
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None
    • Query Optimization
    • Fully Compatible
    • ALL
    • v7.0

      After serialization with "LiteralSerializationPolicy::kToRepresentativeParseableValue", $elemMatch fails to re-parse with the error (with $gte or equivalent operators)

      unknown top level operator: $gte 

      It seems like this may be the case because multiple $elemMatch predicates for one field are dispatched with the syntax 

      { a : { $elemMatch :{$elemMatch:{ b: { $gte: 1, $lte: 1 } } } } }

      but are serialized to 

      { a: { $elemMatch: { $elemMatch: { $and: [ { $lt: 1 }, { $gt: 1 } ] } } } } 

       It seems the $and syntax may be causing re-parseability issues.

       

      You can see the relevant failing tests in the query_stats_passthrough in BF-29272 and BF-29276

            Assignee:
            will.buerger@mongodb.com Will Buerger
            Reporter:
            will.buerger@mongodb.com Will Buerger
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: