Nishil FalduN
Convex Community11mo ago
1 reply
Nishil Faldu

Table Aggregate

https://github.com/get-convex/aggregate/blob/main/example/convex/leaderboard.ts - trying to follow this example here
const aggregateScoreByUser = new TableAggregate<{
  Key: [string, number];
  DataModel: DataModel;
  TableName: "leaderboard";
}>(components.aggregateScoreByUser, {
  sortKey: (doc) => [doc.name, doc.score],
  sumValue: (doc) => doc.score,
});

how does one get the name of the individual with the highest aggregate score? apologies if I missed something in the docs
GitHub
Component for aggregating counts and sums of Convex documents - get-convex/aggregate
aggregate/example/convex/leaderboard.ts at main · get-convex/aggreg...
Was this page helpful?