| Steps To Reproduce: |
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 }
|
|