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

$lt/$lte operator behaves differently when a string comparison is made against a (nested) array of numbers

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 2.4.5
    • Component/s: Querying
    • Environment:
    • ALL

      Problem:
      Appears to be a change in behavior between 2.4.5 and 2.5.4-Pre how $lte and $lt evaluate arrays of numbers.

      NOTE: The behavior in 2.5.4-Pre seems to be correct, ticket is to confirm that.

      Reproduce:

      db.q.drop();
      db.q.insert({"d" : [  [  314159265008,  [  314159265014 ] ] ], "a" : { "b" : { "d" : ISODate("2013-09-29T00:00:00Z") } } })
      db.q.find( { "d" : { $lt : [  "Before I got married I had six theories about bringing up children; now I have six children and no theories." ] } } ).itcount()
      db.q.find( { "d" : { $lte : [  "Before I got married I had six theories about bringing up children; now I have six children and no theories." ] } } ).itcount()
      

      2.4.5: 1 document returned per query
      2.5.4-Pre: Zero documents

      Note:
      These queries produce the same results on both 2.4.5 and 2.5.4-Pre (zero documents)

      db.q.find( { "d" : { $gt : [  "Before I got married I had six theories about bringing up children; now I have six children and no theories." ] } } ).itcount()
      db.q.find( { "d" : { $gte : [  "Before I got married I had six theories about bringing up children; now I have six children and no theories." ] } } ).itcount()
      

        1. server11403.js
          3 kB
          Benety Goh

            Assignee:
            hari.khalsa@10gen.com hari.khalsa@10gen.com
            Reporter:
            alvin Alvin Richards (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: