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

$gte/$gt behave differently when comparing arrays of booleans

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

      Appears to be a change in behavior between 2.4.5 and 2.5.4-Pre how $gte and $gt evaluate arrays of booleans in some cases. The behavior in 2.5.4-Pre seems to be correct, ticket is to confirm that.

      Reproduce:

      db.q.drop();
      db.q.insert({ "b" : [  [  ISODate("2013-09-29T00:00:00Z") ] ] })
      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" : { $gte : [ [ true ] ] } } ).itcount()
      db.q.find( { "b" : { $gte : [ true ] } } ).itcount()
      db.q.find( { "b" : { $gt : [ [ true ] ] } } ).itcount()
      db.q.find( { "b" : { $gt : [ true ] } } ).itcount()
      

      2.4.5: 2 documents returned per query
      2.5.4-Pre: Zero

      Note:
      However, these comparisons works the same on both versions

      db.q.find( { "b" : { $lte : [ [ true ] ] } } ).itcount()
      db.q.find( { "b" : { $lte : [ true ] } } ).itcount()
      db.q.find( { "b" : { $lt : [ [ true ] ] } } ).itcount()
      db.q.find( { "b" : { $lt : [ true ] } } ).itcount()
      db.q.find( { "b" : { $gte : true } } ).itcount()
      db.q.find( { "b" : { $gte : true } } ).itcount()
      db.q.find( { "b" : { $gt : true } } ).itcount()
      db.q.find( { "b" : { $lte : true } } ).itcount()
      db.q.find( { "b" : { $lt : true } } ).itcount()
      

        1. server11402.js
          0.9 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: