noob saibotN
Convex Community14mo ago
7 replies
noob saibot

Is the bound key required when reading an aggregate count with namespace?

First, I have defined an aggregation like so:
app.use(aggregate, { name: "partners_payments" });


Second, in the code, this is how I connect it with the table
payments

export const partnerPaymentsAggregate = new TableAggregate<{
  Key: number;
  Namespace: Id<"partners"> | undefined;
  DataModel: DataModel;
  TableName: "payments";
}>(components.partners_payments, {
  namespace: doc => doc.partner_id,
  sortKey: doc => doc._creationTime,
});


And finally, jere I'm attempting to read the count from it:
const count = await partnerPaymentsAggregate.count(ctx, {
   namespace: partner_id,
});

But typescript screams:
Property 'bounds' is missing in type '{ namespace: Id<"partners">; }' but required in type '{ bounds: Bounds<number, Id<"payments">>; }'.


Is the
bound
property mandatory here? In my particular scenarion, I would like to get the total count of records and not just a part
Was this page helpful?