[JAVA-559] Result of find is not correct (Using Limit) Created: 24/Apr/12  Updated: 25/Jun/13  Resolved: 25/Jun/13

Status: Closed
Project: Java Driver
Component/s: None
Affects Version/s: 2.7.2
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: HyungGi Kim Assignee: Jeffrey Yemin
Resolution: Cannot Reproduce Votes: 0
Labels: driver
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

MongoDB 2.0.4 ( CentOS 5.3 ) --> Sharding : 3 datanode , 3 mongos, 3mongod conf
Java Driver 2.7.2



 Description   

I use the MongoDB and develop by java enviroment. and Using find mehtod with skip and limit, result of find is not correct.
For example find(query).skip(0).limit(1000) --> This query result is not correct, but if i set the limit value 100 or 300, the result is correct.
Query is very simple but use the array index.

What is the problem ? Please Solve this..



 Comments   
Comment by Jeffrey Yemin [ 25/Jun/13 ]

Please re-open if you have additional information

Comment by Jeffrey Yemin [ 12/Aug/12 ]

Sorry we lost track of this. Can you try to reproduce this with server version 2.0.7? This looks similar to SERVER-4680.

Comment by HyungGi Kim [ 24/Apr/12 ]

Full query is very simple

query is
db.data.find({"$and" : [ { "indexcol" : { "$all" : ["string"]}}]}).skip(0).limit(500);

Total Count is 912 but result of limit is 433

Shard Key is UNIX TimeStamp

query explain

{
"clusteredType" : "ParallelSort",
"shards" : {
"server01:100" : [
{
"cursor" : "BtreeCursor indexcol_1",
"nscanned" : 108,
"nscannedObjects" : 108,
"n" : 108,
"millis" : 8,
"nYields" : 0,
"nChunkSkips" : 0,
"isMultiKey" : true,
"indexOnly" : false,
"indexBounds" :

{ "indexcol" : [ [ "string", "string" ] ] }

}
],
"server02:101" : [
{
"cursor" : "BtreeCursor indexcol_1",
"nscanned" : 185,
"nscannedObjects" : 185,
"n" : 185,
"millis" : 13,
"nYields" : 0,
"nChunkSkips" : 0,
"isMultiKey" : true,
"indexOnly" : false,
"indexBounds" :

{ "indexcol" : [ [ "string", "string" ] ] }

}
],
"server03:102" : [
{
"cursor" : "BtreeCursor indexcol_1",
"nscanned" : 500,
"nscannedObjects" : 500,
"n" : 500,
"millis" : 38,
"nYields" : 2,
"nChunkSkips" : 0,
"isMultiKey" : true,
"indexOnly" : false,
"indexBounds" :

{ "indexcol" : [ [ "string", "string" ] ] }

}
]
},
"n" : 793,
"nChunkSkips" : 0,
"nYields" : 2,
"nscanned" : 793,
"nscannedObjects" : 793,
"millisTotal" : 59,
"millisAvg" : 19,
"numQueries" : 3,
"numShards" : 3
}

Thank you

Comment by Scott Hernandez (Inactive) [ 24/Apr/12 ]

Can you issue the same query + explain from the mongo javascript shell? Please include the full query + results.

Generated at Thu Feb 08 08:52:34 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.