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

$gt/$lt/$ne with scalar operand yields inconsistent matches on arrays

    • Query
    • ALL

      When the document in the collection contains an array:

      {a: [1,10]}
      

      and we run a non-equality query with a scalar operand, we see the following results:

      {a: {$gt: 1}} -----> 1 document
      {a: {$lt: 1}} -----> 0 document
      {a: {$ne: 1}} -----> 0 document
      
      > db.f.drop()
      true
      > db.f.save( {a:[1,10]} )
      > db.f.find( {a:{$gt:1}} )
      { "_id" : ObjectId("4cb5fdb359001b4d0429c9de"), "a" : [ 1, 10 ] }
      > db.f.find( {a:{$ne:1}} )
      > 
      

        1. server1937.js
          0.2 kB
          Benety Goh
        2. test.csv
          2 kB
          Aaron Staple
        3. test.js
          3 kB
          Aaron Staple

            Assignee:
            backlog-server-query Backlog - Query Team (Inactive)
            Reporter:
            aaron Aaron Staple
            Votes:
            3 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: