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

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

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

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

        1. server11405.js
          0.8 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: