[GODRIVER-1831] Find `Limit` Options not work in MongoDB 2.6 Created: 12/Jan/21 Updated: 28/Oct/23 Resolved: 27/Jan/21 |
|
| Status: | Closed |
| Project: | Go Driver |
| Component/s: | API |
| Affects Version/s: | 1.4.4 |
| Fix Version/s: | 1.4.6 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Lau Liqiang | Assignee: | Benji Rewis (Inactive) |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
MongoDB == 2.6.12 |
||
| Issue Links: |
|
||||||||
| Description |
|
First I run a MongoDB 2.6 with docker:
Then I using mongo-go-driver to try List `Limit` Option, the code is following:
Result is 1001,Which we expected to be 1000. |
| Comments |
| Comment by Kevin Albertson [ 11/Feb/21 ] | ||||||||||||
|
Cherry-picked onto release/1.5 with https://github.com/mongodb/mongo-go-driver/commit/f537927df8af103150a7cbf85711a0dbae24d9c9 | ||||||||||||
| Comment by Githook User [ 27/Jan/21 ] | ||||||||||||
|
Author: {'name': 'Benjamin Rewis', 'email': '32186188+benjirewis@users.noreply.github.com', 'username': 'benjirewis'}Message: | ||||||||||||
| Comment by Benji Rewis (Inactive) [ 27/Jan/21 ] | ||||||||||||
|
liqianglau@outlook.com This issue should be fixed in version 1.4.6 (the upcoming stable release) of the driver. | ||||||||||||
| Comment by Githook User [ 27/Jan/21 ] | ||||||||||||
|
Author: {'name': 'Benjamin Rewis', 'email': '32186188+benjirewis@users.noreply.github.com', 'username': 'benjirewis'}Message: | ||||||||||||
| Comment by Benji Rewis (Inactive) [ 21/Jan/21 ] | ||||||||||||
|
Bug fix and new associated tests in this PR: | ||||||||||||
| Comment by Kevin Albertson [ 19/Jan/21 ] | ||||||||||||
|
Hi Lau, thank you for submitting the pull request! Our CI testing platform, Evergreen, needs to be manually authorized to run against external pull requests. The tests are running now. Members of the team will review the PR. | ||||||||||||
| Comment by Lau Liqiang [ 18/Jan/21 ] | ||||||||||||
Hi,Kevin Albertson:After some code review and test we find out maybe the promblem is occured here: https://github.com/mongodb/mongo-go-driver/blob/master/x/mongo/driver/batch_cursor.go#L242-L253 As the code show following:
if we not set the batchSize, and set limit to 1000,if bc.numReturned = 1000 ,the result for numToReturn will be 0, and it would be passed a params to getMore below it。 So the result will more than expected 1000。 We are preparing a patch for it,but WIP:https://github.com/mongodb/mongo-go-driver/pull/561,it seems we have some permission problem for CI。Any suggestions for it?
Thanks。
| ||||||||||||
| Comment by Kevin Albertson [ 12/Jan/21 ] | ||||||||||||
|
Thank you for the report liqianglau@outlook.com! I was able to reproduce the issue with the script you provided. |