
A typical workflow with ORMs is to, for example, fetch an item from the DB and include the user who created it. How would I do that with AppWrite? Is that easily available in the docs somewhere?
Here's an example:
const response = await databases.getDocument(
DATABASE_ID,
BOOKS_COLLECTION_ID,
id,
// Maybe I should add some sort of query here?
)

Also, do I need to create a table on the DB to fetch info on other users?

You need to have an attribute representing the creator of the doc.

Could you share more details about your usecases?

For now, it's as simple as it gets. I have users, each user can create a book (which consists of a title, description, and the author's ID). Then, when a user click's on a book's page, I would like to show the book itself, as well as its author's username. It should be equivalent to a simple SQL JOIN.

Drizzle and Prisma both have that sort of thing in their docs, but I haven't been able to find it on Appwrite yet.

I did create a second table for user data, replicating and extending the auth data.

You could use relationship But doing it with saving the id of the author/user in the book document will be far more stable.

Fetch the doc using query.equal of userid with the creator id in your books collection

I do save the author's id in the book document.

How do I do that in the JS package?

const response = await databases.listDocument(
DATABASE_ID,
BOOKS_COLLECTION_ID,
[
Query.equal('Author':['name']),
]
)

By default there will be upto 25 docuement present if condition meets You could decrease or increase using Query.limit


Check out here for more details

I don't think that's what I want actually. That's a filter, what I'm looking for is a JOIN
statement equivalent between 2 tables. That sort of thing only tackles 1 table.

There is no Join Eq. https://appwrite.io/threads/1326625067022684305

That's so essential to these sorts of products though. Very strange. It should be kinda like the first thing on a feature list priority queue, I believe.

You could make a feature request in github 🤷♂️.

How do they plan on dealing with that sort of issue. Do they plan on implementing joins at some point? Do they have an alternative solution? Is this how it's going to be forever?

The best i can say is if The Join feature request is more wanted by users then it might be added in the future version But currently the way is to establish a link via atrribute
Recommended threads
- My collection is not updating after csv ...
- Invalid 'success' param error (React Nat...
I am trying to set up a "Sign in with Google" button using OAuth2. While I was successful in getting the button to work for web, when I try with mobile I get t...
- Attribute stuck on proccessing
i tried creating a new attribute butits stuck on proccessing,i did a hard refresh,cleared cache everything but still stuck on proccessing,also in my functions w...
