Not sure why this is throwing a "multiple paginated queries" error
Schema:
Error:
Calling once with arguments:
6 Replies
Thanks for posting in <#1088161997662724167>.
Reminder: If you have a Convex Pro account, use the Convex Dashboard to file support tickets.
- Provide context: What are you trying to achieve, what is the end-user interaction, what are you seeing? (full error message, command output, etc.)
- Use search.convex.dev to search Docs, Stack, and Discord all at once.
- Additionally, you can post your questions in the Convex Community's <#1228095053885476985> channel to receive a response from AI.
- Avoid tagging staff unless specifically instructed.
Thank you!
The query is calling
paginate()
multiple times, it can only be called once per convex query function invoication
So you'll want to have a query that accepts pagination options as args, so that query can be called once per page
You can turn the query function there into an action, and then split out the pagination part to a query, and the action will be able to loop over the pages and call the query the way you're expectingI would guess that the idea behind this limitation is that otherwise, using
paginate
to iterate through all of the documents in a table like this would be basically equivalent to doing myQuery.collect()
, with the same shortcomings.
So the (implicit) suggestion is to either just use collect()
, or break it up across multiple Convex functionsYeah the docs show how to do it: https://docs.convex.dev/database/pagination#writing-paginated-query-functions
Ahh thank you @erquhart! Makes sense, if a little unintuitive. I guess I can't paginate through a table in its own query.
Yeah, I've definitely tried to do this before lol