[GODRIVER-867] options.FindOptions.SetLimit() docs suggest negative limits are still supported, but they're not Created: 07/Mar/19  Updated: 28/Oct/23  Resolved: 29/Apr/19

Status: Closed
Project: Go Driver
Component/s: CRUD
Affects Version/s: 1.0.0-rc2
Fix Version/s: 1.0.2

Type: Bug Priority: Minor - P4
Reporter: Duncan Armstrong Assignee: Divjot Arora (Inactive)
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to DRIVERS-2120 Add CRUD spec test for negative limit Backlog
Backwards Compatibility: Fully Compatible

 Description   

The docs for options.FindOptions.SetLimit() suggest that negative limits are valid, when in fact the server returns an error if you try ("Error: (BadValue) Limit value must be non-negative, but received: <N>"). This is because the driver uses the newer find command, which doesn't support negative limits.

(mgo supported negative limits, presumably by converting it to a positive limit + singleBatch=true, which adds to the confusion - as does the fact that the shell's cursor.limit() supports negative limits too!)



 Comments   
Comment by Githook User [ 29/Apr/19 ]

Author:

{'name': 'Divjot Arora', 'username': 'divjotarora', 'email': 'divjot.arora@10gen.com'}

Message: Support negative limits for find commands

GODRIVER-867

Change-Id: Ibaad9e1a081969499a91ca426f38c54bede7fad7
Branch: release/1.0
https://github.com/mongodb/mongo-go-driver/commit/79bf12663dfd3b92cbe59e610a587fc0939327f2

Comment by Githook User [ 29/Apr/19 ]

Author:

{'email': 'divjot.arora@10gen.com', 'name': 'Divjot Arora', 'username': 'divjotarora'}

Message: Support negative limits for find commands

GODRIVER-867

Change-Id: Ibaad9e1a081969499a91ca426f38c54bede7fad7
Branch: master
https://github.com/mongodb/mongo-go-driver/commit/0baf5badaea6104b40cc399fc9836f74ad418e87

Comment by Divjot Arora (Inactive) [ 24/Apr/19 ]

CR: https://review.gerrithub.io/c/mongodb/mongo-go-driver/+/451903

Comment by Jeffrey Yemin [ 07/Mar/19 ]

The CRUD spec still requires negative limit support, so Go driver should support it for consistency, though it appears there are no CRUD spec tests that assert it.

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