You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: add WithMaxRows option to cap find() and countDocuments() results (#17)
Add functional options pattern to Execute() with WithMaxRows(n) that
caps find() and countDocuments() results at the driver level.
- Add ExecuteOption type and WithMaxRows() function
- Apply min(queryLimit, maxRows) in executeFind and executeCountDocuments
- Aggregate operations intentionally not affected
- Add comprehensive tests for all limit scenarios
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: README.md
+19Lines changed: 19 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -53,6 +53,25 @@ func main() {
53
53
}
54
54
```
55
55
56
+
## Execute Options
57
+
58
+
The `Execute` method accepts optional configuration:
59
+
60
+
### WithMaxRows
61
+
62
+
Limit the maximum number of rows returned by `find()` and `countDocuments()` operations. This is useful to prevent excessive memory usage or network traffic from unbounded queries.
0 commit comments