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

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

    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

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

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved: