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

$gt/$gte behavior change when comparing arrays of numbers

    XMLWordPrintable

    Details

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

      Description

      Reproduce:

      db.q.drop()
      db.q.insert({ "b" : [  314159265010,  314159265001,  [  314159265000,  "" ] ] })
      db.q.insert({ "b" : [  1,  [  [  {   } ] ],  {  "1" : [  false ] } ] })
      db.q.insert({ "d" : { "b" : { "c" : { "b" : { "b" : { "c" : "Everyone is a genius at least once a year. The real geniuses simply have their bright ideas closer together." } } } } }, "b" : [  [  ISODate("2013-09-29T00:00:00Z") ] ] })
      db.q.insert({ "b" : [ 	{ 	"0" : 0, 	"d" : { 	"a" : Infinity } }, 	[ 	{ 	"d" : { 	"a" : { 	 } } } ] ] })
      db.q.insert({ "b" : [ 	[ 	ISODate("2008-02-29T00:00:00Z") ], 	"An inventor is simply a fellow who doesnt take his education too seriously." ] })
      db.q.find( { "b" : { $gt : [ 0 ] } } ).itcount()
      db.q.find( { "b" : { $gte : [ 0 ] } } ).itcount()

      2.4.5: 5 documents returned for each query
      2.5.4-Pre: zero return for each query

      Note:
      The queries return the same results on both version (zero documents)

       

      db.q.find( { "b" :

      { $gt : 0 }

      } ).itcount()
      db.q.find( { "b" :

      { $gte : 0 }

      } ).itcount()
      db.q.find( { "b" :

      { $lt : 0 }

      } ).itcount()
      db.q.find( { "b" :

      { $lte : 0 }

      } ).itcount()
      db.q.find( { "b" :

      { $lt : [ 0 ] }

      } ).itcount()
      db.q.find( { "b" :

      { $lte : [ 0 ] }

      } ).itcount()

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved: