certain queries only provide disklocs for first batch of responses

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Duplicate
    • Priority: Minor - P4
    • None
    • Affects Version/s: 2.4.8
    • Component/s: Querying
    • None
    • ALL
    • Hide

      Prepare the collection:

      db.c.drop()
      for (var i=0; i<5; i++)
          db.c.insert({})
      

      Run the query, only gives disklocs for first batch:

      db.c.find({}, {_id:1}).hint({_id:1}).batchSize(2).showDiskLoc().forEach(function(d) {
          printjson(d['$diskLoc'])
      })
      
      { "file" : 0, "offset" : 1941680 }
      { "file" : 0, "offset" : 1941720 }
      undefined
      undefined
      undefined
      

      Use a BasicCursor instead and it works as expected:

      db.c.find({}, {_id:1}).hint({$natural:1}).batchSize(2).showDiskLoc().forEach(function(d) {
          printjson(d['$diskLoc'])
      })
      
      { "file" : 0, "offset" : 1941680 }
      { "file" : 0, "offset" : 1941720 }
      { "file" : 0, "offset" : 1941760 }
      { "file" : 0, "offset" : 1941800 }
      { "file" : 0, "offset" : 1941840 }
      

      Or remove the projection and it also works as expected:

      db.c.find({}).hint({_id:1}).batchSize(2).showDiskLoc().forEach(function(d) {
          printjson(d['$diskLoc'])
      })
      
      { "file" : 0, "offset" : 1941680 }
      { "file" : 0, "offset" : 1941720 }
      { "file" : 0, "offset" : 1941760 }
      { "file" : 0, "offset" : 1941800 }
      { "file" : 0, "offset" : 1941840 }
      
      Show
      Prepare the collection: db.c.drop() for ( var i=0; i<5; i++) db.c.insert({}) Run the query, only gives disklocs for first batch: db.c.find({}, {_id:1}).hint({_id:1}).batchSize(2).showDiskLoc().forEach(function(d) { printjson(d[ '$diskLoc' ]) }) { "file" : 0, "offset" : 1941680 } { "file" : 0, "offset" : 1941720 } undefined undefined undefined Use a BasicCursor instead and it works as expected: db.c.find({}, {_id:1}).hint({$natural:1}).batchSize(2).showDiskLoc().forEach(function(d) { printjson(d[ '$diskLoc' ]) }) { "file" : 0, "offset" : 1941680 } { "file" : 0, "offset" : 1941720 } { "file" : 0, "offset" : 1941760 } { "file" : 0, "offset" : 1941800 } { "file" : 0, "offset" : 1941840 } Or remove the projection and it also works as expected: db.c.find({}).hint({_id:1}).batchSize(2).showDiskLoc().forEach(function(d) { printjson(d[ '$diskLoc' ]) }) { "file" : 0, "offset" : 1941680 } { "file" : 0, "offset" : 1941720 } { "file" : 0, "offset" : 1941760 } { "file" : 0, "offset" : 1941800 } { "file" : 0, "offset" : 1941840 }
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None

      Query using BtreeCursor over the _id index, do a projection, and request disklocs. The diskloc request is only honored for the first batch of responses.

            Assignee:
            David Storch
            Reporter:
            Bruce Lucas (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: