aggregate index
export const pageDelete = query({
args: {
index: v.number(),
pageSize: v.number()
},
handler: async (ctx, { index, pageSize }) => {
const { key } = await timeline_aggregate.at(ctx, index);
console.log(key);
let pageData = getPage(ctx, {
table: "timeline",
index: "start_index",
startIndexKey: key,
targetMaxRows: pageSize,
schema: schema
});
return (await pageData).page;
},
});
if I pass in zero and 12, the first record I get back is the record at index 1
@lee is this how get page should work? is it not supposed to include the record at startIndexKey: key?
5 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!
@lee if so, how do you get the first record?
check out docstrings https://github.com/get-convex/convex-helpers/blob/cc333c5db828054ebb1d9c4ffb3119729980d644/packages/convex-helpers/server/pagination.ts#L21
GitHub
convex-helpers/packages/convex-helpers/server/pagination.ts at cc33...
A collection of useful code to complement the official packages. - get-convex/convex-helpers
Just found it myself, but you beat me to it, thank you so much
I was just going to past the answer back in here