Skip to content

Stop paginating finds that can run inside a transaction - #5

Merged
mgilardi merged 1 commit into
mainfrom
k708-no-paginated-finds
Nov 23, 2026
Merged

mgilardi merged 1 commit into
mainfrom
k708-no-paginated-finds

Conversation

@mgilardi

Copy link
Copy Markdown
Contributor

K708. 1 find(s) that pass req and only use the rows now pass pagination: false, so the Mongo adapter doesn't send a count beside the find. As a transaction's first query, the two race and one fails with NoSuchTransaction (found in positions). Limits still apply. Paged lists for people are unchanged. Typecheck and the full suite pass locally.

🤖 Generated with Claude Code

A paginated find makes Payload's Mongo adapter send the find and its
count at once on the request's session. When that is the first query in
a transaction, the two race to start it and one fails with
NoSuchTransaction (about 1 in 7 in the positions plugin, where it was
found). These finds only use the rows, so pagination: false drops the
count and the race; any limit still applies.

Lists that page for people (a page argument, totals returned) are left
as they are. They run outside any transaction.

Tested: typecheck and the full suite. The race itself isn't reproduced
here; Whitehat's lint is meant to catch new cases.

Task: K708

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mgilardi
mgilardi merged commit d634d85 into main Nov 23, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant