Designing a friend system with Convex
Convex and am torn between two approaches:1. Multiple indexes for better scalability.
2. Multiple entries in a single table for each friendship.
I’ve implemented lexicographical sorting for user1 and user2 when inserting friendships, but when querying friendships for a user, the following approach is limited by the compound index:
The problem is that compound indexes require the query order to match the order in which the fields were indexed
(e.g., ['user1', 'user2']), which limits flexibility in querying.I’ve come up with a solution where id just do multiple entries, 1 for each side of the friendship, but I’m concerned about scalability. Is there a better way to handle this without creating multiple entries for each friendship or excessive indexes?
I'm very curious how to tackle this, specifically if there is any way that goes great with Convex?
