codebirdC
Convex Community14mo ago
9 replies
codebird

Document IDs | Convex Developer Hub

Hi,
1. Can someone explain the difference between userID, _id and Id?
2. Is the userId same as _id? or does each userId has a different _id?
3. Also, the docs mention that we need to mention Id<"tasks" like const task = useQuery(api.tasks.getTask, { taskId: id as Id<"tasks"> }) to ensure that the ID belongs to the expected table, but haven’t we already declared the expected table beforehand in the query itself- “api.tasks.getTask, so why do we need this { taskId: id as Id<"tasks"> } syntax?

Reference- https://docs.convex.dev/database/document-ids
Create complex, relational data models using IDs.
Document IDs | Convex Developer Hub
Was this page helpful?