oscklmO
Convex Community2y ago
4 replies
oscklm

Getting random results back when querying a table, specifically using a paginated query?

Hello,

I'm facing challenges while attempting to retrieve data at random from a table.

The current process, in this example a paginated query - delivers results in the order the data was added to the table, which does not meet our needs.

A bit of context, our content managers tend to upload videos relevant to a single category (for example, food) at a time. Consequently, fetching data in order would result in a high concentration of videos from the same category – all 60 food videos might be returned in one query. This is mostly right now, as our content managers are bulk uploading a bunch of content.

We'd love to show a big mix of videos - totally random - every time we pull data, instead of just getting a bunch from one category. Sadly this limitation greatly affects a important part of our app.

Anyone able to guide me in the right direction here, as i fail to see how this can be done with Convex.
Was this page helpful?