burnstony#1975
burnstony#19752mo ago

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
Convex Bot
Convex Bot2mo ago
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!
burnstony#1975
burnstony#1975OP2mo ago
@lee if so, how do you get the first record?
lee
lee2mo ago
/** Whether the startIndexKey is inclusive. Default is false. */
startInclusive?: boolean;
/** Whether the startIndexKey is inclusive. Default is false. */
startInclusive?: boolean;
burnstony#1975
burnstony#1975OP2mo ago
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
const startInclusive = request.startInclusive ?? false;
const startInclusive = request.startInclusive ?? false;

Did you find this page helpful?