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

Dates shown in indexBounds are incorrect

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major - P3 Major - P3
    • None
    • 2.6.4
    • Querying
    • None
    • ALL
    • Hide

      > for(var a = 0 ;a < 100; a++){db.foo.insert({"a": new Date()})}
      WriteResult({ "nInserted" : 1 })
      > db.foo.ensureIndex({a:1})
      > db.foo.find({a:{$gt: ISODate("2014-09-15T22:18:08.403Z")}}).explain()
      {
              "cursor" : "BtreeCursor a_1",
              "isMultiKey" : false,
              "n" : 99,
              "nscannedObjects" : 99,
              "nscanned" : 99,
              "nscannedObjectsAllPlans" : 99,
              "nscannedAllPlans" : 99,
              "scanAndOrder" : false,
              "indexOnly" : false,
              "nYields" : 1,
              "nChunkSkips" : 0,
              "millis" : 485,
              "indexBounds" : {
                      "a" : [
                              [
                                      ISODate("2014-09-15T22:18:08.403Z"),
                                      ISODate("0NaN-NaN-NaNTNaN:NaN:NaNZ")
                              ]
                      ]
              },
              "server" : "testpc:27017",
              "filterSet" : false
      }

      Show
      > for(var a = 0 ;a < 100; a++){db.foo.insert({"a": new Date()})} WriteResult({ "nInserted" : 1 }) > db.foo.ensureIndex({a:1}) > db.foo.find({a:{$gt: ISODate("2014-09-15T22:18:08.403Z")}}).explain() { "cursor" : "BtreeCursor a_1", "isMultiKey" : false, "n" : 99, "nscannedObjects" : 99, "nscanned" : 99, "nscannedObjectsAllPlans" : 99, "nscannedAllPlans" : 99, "scanAndOrder" : false, "indexOnly" : false, "nYields" : 1, "nChunkSkips" : 0, "millis" : 485, "indexBounds" : { "a" : [ [ ISODate("2014-09-15T22:18:08.403Z"), ISODate("0NaN-NaN-NaNTNaN:NaN:NaNZ") ] ] }, "server" : "testpc:27017", "filterSet" : false }

    Description

      MongoDB shell shows incorrect date when explain() is run with find() query on an indexed Date field.

      1. Simply fill a collection with 100 documents containing a date field
      2. Create an index on the date field.
      3. Run a simple find query with explain() and see the indexBounds on the date field.

      > for(var a = 0 ;a < 100; a++){db.foo.insert({"a": new Date()})}
      WriteResult({ "nInserted" : 1 })
      > db.foo.ensureIndex({a:1})
      > db.foo.find({a:{$gt: ISODate("2014-09-15T22:18:08.403Z")}}).explain()
      {
              "cursor" : "BtreeCursor a_1",
              "isMultiKey" : false,
              "n" : 99,
              "nscannedObjects" : 99,
              "nscanned" : 99,
              "nscannedObjectsAllPlans" : 99,
              "nscannedAllPlans" : 99,
              "scanAndOrder" : false,
              "indexOnly" : false,
              "nYields" : 1,
              "nChunkSkips" : 0,
              "millis" : 485,
              "indexBounds" : {
                      "a" : [
                              [
                                      ISODate("2014-09-15T22:18:08.403Z"),
                                      ISODate("0NaN-NaN-NaNTNaN:NaN:NaNZ")
                              ]
                      ]
              },
              "server" : "testpc:27017",
              "filterSet" : false
      }

      Attachments

        Activity

          People

            ramon.fernandez@mongodb.com Ramon Fernandez Marina
            riyyaz Riaz Ahmed
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: