BarisB
Convex Community2y ago
25 replies
Baris

How can I sort a query by a field in the referenced document?

Hi, In one of my tables, there is a field named user_id that holds a user document’s ID, and in the user table, there is a string name field that holds the user’s name.

I want to sort the first table by the referenced user’s name, but this doesn’t seem possible with indexes.

The only thing I could do seems to be fetching all documents and sorting them with JavaScript, but this isn’t feasible because of the 16 k document scan limit. I want to do this with pagination. How can I achieve it?
Was this page helpful?