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

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Duplicate
    • Affects Version/s: 2.4.5
    • Fix Version/s: None
    • Component/s: Querying
    • Environment:
    • Operating System:
      ALL

      Description

      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()

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: