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

Documents with value Infinity for index key not returned in query in 2.4

    • Type: Icon: Bug Bug
    • Resolution: Won't Fix
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Querying
    • Environment:
    • Fully Compatible
    • ALL
    • Hide

      2.4.9-pre-

      > db.c.insert({a:Infinity})
      > db.c.find({a:{$gt:0}})
      { "_id" : ObjectId("528ffb985142cd7d1e23d1cf"), "a" : Infinity }
      > db.c.ensureIndex({a:1})
      > db.c.find({a:{$gt:0}})
      

      2.5.5-pre-

      > db.c.insert({a:Infinity})
      Insert WriteResult({ "ok" : 1, "n" : 1 })
      > db.c.find({a:{$gt:0}})
      { "_id" : ObjectId("528ffb986ce2fec2710a136f"), "a" : Infinity }
      > db.c.ensureIndex({a:1})
      > db.c.find({a:{$gt:0}})
      { "_id" : ObjectId("528ffb986ce2fec2710a136f"), "a" : Infinity }
      
      Show
      2.4.9-pre- > db.c.insert({a:Infinity}) > db.c.find({a:{$gt:0}}) { "_id" : ObjectId( "528ffb985142cd7d1e23d1cf" ), "a" : Infinity } > db.c.ensureIndex({a:1}) > db.c.find({a:{$gt:0}}) 2.5.5-pre- > db.c.insert({a:Infinity}) Insert WriteResult({ "ok" : 1, "n" : 1 }) > db.c.find({a:{$gt:0}}) { "_id" : ObjectId( "528ffb986ce2fec2710a136f" ), "a" : Infinity } > db.c.ensureIndex({a:1}) > db.c.find({a:{$gt:0}}) { "_id" : ObjectId( "528ffb986ce2fec2710a136f" ), "a" : Infinity }

      A document that has the value Infinity for a key that is indexed is not returned in queries that use that index in MongoDB version 2.4. Version 2.5 does not seem to have this issue. Seems like there should be a fix for 2.4 or this change in behavior between versions be documented (if it is intentional).

            Assignee:
            benety.goh@mongodb.com Benety Goh
            Reporter:
            luke.lovett Luke Lovett
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: