range queries against an indexed field within an array ignores the upper (or lower) bound

XMLWordPrintableJSON

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

      See: http://groups.google.com/group/mongodb-user/browse_thread/thread/7a67b122e4bf495a

      I don't know if this a feature of multikeys or what but it seems wrong...

      Imagine I have a collection with documents that look like this:

      {
      name: "Test"
      details: [

      { timestamp: 1319083200000, type: "something" }

      ,

      { timestamp: 1320083200000, type: "something else" }

      ]
      }

      These commands will create one of those documents, index it, and then explain a query:

      db.testdocuments.insert({name: "Test", details: [

      {timestamp: 1319083200000, type: "something"}

      ,

      {timestamp: 1320083200000, type: "something else"}

      ]})
      db.testdocuments.ensureIndex(

      {"details.timestamp": 1}

      )
      db.testdocuments.find({'details.timestamp': {$gte:
      1319083200000, $lte: 1319093200000}}).explain()
      {
      "cursor" : "BtreeCursor details.timestamp_1",
      "nscanned" : 404081,
      "nscannedObjects" : 404081,
      "n" : 3494,
      "millis" : 3063,
      "nYields" : 455,
      "nChunkSkips" : 0,
      "isMultiKey" : true,
      "indexOnly" : false,
      "indexBounds" :

      { "details.timestamp" : [ [ 1319083200000, 1.7976931348623157e+308 ] ] }


      }

      NOTE the upper bound is messed up...

      If I do a descending index the lower bound is messed up.

      Also, note that if you create a document that only has one element in the details array the index bounds are correct.

            Assignee:
            Aaron Staple (Inactive)
            Reporter:
            Andrew Harbick
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: