Fetching another document's data via id in query
schema.ts
chat.ts
How do I read a user's name when querying the messages via the userId property? For context, I'm using ConvexAuth.5 Replies
Thanks for posting in <#1088161997662724167>.
Reminder: If you have a Convex Pro account, use the Convex Dashboard to file support tickets.
- Provide context: What are you trying to achieve, what is the end-user interaction, what are you seeing? (full error message, command output, etc.)
- Use search.convex.dev to search Docs, Stack, and Discord all at once.
- Additionally, you can post your questions in the Convex Community's <#1228095053885476985> channel to receive a response from AI.
- Avoid tagging staff unless specifically instructed.
Thank you!
Relevant docs here: https://docs.convex.dev/database/reading-data/#join
Also highly recommend the tutorial to get up to speed on Convex: https://docs.convex.dev/tutorial/
convex-helpers
? I don't recall finding a mention of it in the docs anywhere.
I did read the docs but stumbled into another problem. Apparently, identity.subject
is of type string
, while message.userId
expects an Id<>
, so the solution you provided does not work in my case, and I'm not sure how can I fix this.
And I did go through everything in the tutorial. Thanks for the suggestion regardless! And thanks for taking your time to help out.Use
getAuthUserId
from convex-dev/auth/server
instead of getUserIdentity
The convex helper is just a little nicer than the vanilla js approach using Promise.all and array.map. They work the same.Oh, I see. Thank you so much!
It does indeed look a lot nicer. Thank you, much appreciated!