TwendyKirn
CCConvex Community
•Created by TwendyKirn on 9/22/2024 in #support-community
Quering random row
Hello, what would be the best way to query a random row from DB via Convex? I have a game project where users should get a random image, each image should be a row in DB (ideally) and there will be more than 100 images.
20 replies
CCConvex Community
•Created by TwendyKirn on 3/30/2024 in #support-community
Auth API key
Hello, I'm planning to implement Auth via API keys inside HTTP actions from Convex.
Usage example: User creates account through Clerk on my website. Then do some data manipulation on the website (including creation of api key per project) and then he can load that data through HTTP actions with their api key, that way I can track usage and etc. Sooo simple SaaS model, nothing super special. But i was wondering if there are any articles/advices/libraries/best practices for Convex? I know that ideally I should hash keys on creation which technically shouldnt be a problem through vercel actions.
5 replies
CCConvex Community
•Created by TwendyKirn on 3/27/2024 in #support-community
Shared types in Schema
Hello, is it possible to create some sort of shared type (something like interface from TS) for Convex schema? I have the same fields in table schema and in the mutation params but it still different from Doc<...>, so I was wondering if I can somehow combine them into 1 generic type and share between mutation and DB schema. Otherwise right now I need to change types in both places.
3 replies
CCConvex Community
•Created by TwendyKirn on 3/13/2024 in #support-community
Set dynamic key in v.object inside database schema
Hello, is it possible to set a dynamic object key inside the schema? Use case: I have an object which stores metada of each element, it looks like
{ [elementId: string]: {....some data} }
8 replies
CCConvex Community
•Created by TwendyKirn on 1/30/2024 in #support-community
How to implement new message arrival in the channel
Hello, thank you so much for the platform! I have a question regarding channels app (similar to Telegram). We need to show a generic read/unread logic for our channels when new post is published. But Im not sure what the best practice with Convex would look like. Currently we are saving each channel follower as separate document with
isNewMessage
param. But I assume that we would hit the limits if for example 20k channel gonna publish a post and then we gonna need to go through each follower and update that param. Also its unclear how to update all of them at once if we wouldnt have a limit because it seems like you need ID of each document before patch. Which means that firstly we gonna need to read all documents for this channel then loop through all of them and try to patch. Would really love to hear a possible solution! Thank you for your time and support! 🙂4 replies