One-to-many relationships
I am already using a one to many relationship if I am not wrong. I have projects table and a documents table where one project can have multiple documents, so I am storing the documentIds as an array.

3 Replies
You could get rid of the documents array entirely, and use
documents.project
to join a project to it's documents.
In a one-to-many, the one doesn't need a direct reference to the many, the many just need a direct reference to the one. You would get a project id and then query all documents that belong to that project.@kunga_tashi this blog post is gem take a look it will clear your doubts https://stack.convex.dev/relationship-structures-let-s-talk-about-schemas
Relationship Structures: Let's Talk About Schemas
In this post we’ll look at some patterns for structuring relationships in the Convex database.
@Abhishek @erquhart Thanks you two, Although I read that article, I didn't see the back reference part last time hehe.