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

indexed elemMatch query incorrectly matches non-array field

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 2.5.5
    • Affects Version/s: 2.5.5
    • Component/s: Querying
    • Environment:
      git hash 6902c6b643f645613f231bcde4bf2b1a86f63c21
    • Fully Compatible
    • ALL

      Using a collection with these documents:

      {a: 4}
      {a: [4]}
      

      and index:

      {a: 1}
      

      The query

      {a: ${elemMatch: {$gt: 3}}}
      

      is returning both documents when it should match only

      {a: [4]}
      

            Assignee:
            benety.goh@mongodb.com Benety Goh
            Reporter:
            benety.goh@mongodb.com Benety Goh
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: