sonandmjyS
Convex Community12mo ago
10 replies
sonandmjy

filtering documents with getPage

I'm looking at the getPage function so I can control the pagination more. But I can't seem to figure out how the filtering works. For example, I have a messages table that stores messages all the messages from many companies. However, I'm not sure how I would only include those results in the getPage return since I don't see a param that allows me to filter my index 🤔

eg this is my function right now and I only want the results with only a particular channelId and destinationId. How would I achieve this?

Thank you for any advice in advance!

 const { page: _page, ...response } = yield* Effect.promise(() =>
      getPage(ctx, {
        table: "messages",
        index: "by_destination_and_channel_id",
        schema: schema,
        order,
        startIndexKey: args.startIndexKey,
        endIndexKey: args.endIndexKey,
        endInclusive: args.endInclusive,
        startInclusive: args.startInclusive,
      }),
    );
Was this page helpful?