I have a Post collection with reference to User collection using userId. When I get all post, is there a way to automatically get user's details as well for each post? Im using Client SDK and Cloud.
Not for now (it's not available in the self-hosted version as well) For this use case it will be a bit complex
- either move the whole logic to a cloud function (which can be overwhelming)
- make a sequential request to get user details
Hey @Binyamin , if I install server SDK and set the relationship programmatically. Will it work for my use case?
Im about to try this. But As I read your reply, would like to double check. https://appwrite.io/docs/databases-relationships#create-in-code
Relationship won't work as you're working with the cloud
I see... I need self-hosted for it to work? What combination of AppWrite tools or setup would you suggest so I can create a complex App with AppWrite?
Do you have links to some repo that implements complex CRUD using React/Next? Would really appreciate it. π
Some features Im looking to try to implement with Appwrite:
- Posts with image and user info (CRUD) - there will be a lot of posts so creating new request to get user info for each post might not be ideal.
- Saved posts
- User groups
Notes:
- In self hosted you'll solve only the for the first part, the relationship, but for the second part - user to collection relationship this is not available right now in any version.
- If you need to connect posts to author collection, then in this case I would recommend going with self-hosted or wait for the cloud to support relationships.
- For the React part I recommend checking the react at awesome-appwrite
Structure:
You can do something like this.
Create another users collection, in add all of your user details, create a function that will get trigger each time new user is created or edited, then you can update that users collection with ease.
In the posts collection add user_id relationship field of many to one to the users collection.
For user groups the best would be to use Appwrite teams
I see gotcha! Thanks @Binyamin π
Hey @Binyamin if I go this path - "make a sequential request to get user details", will I hit request limit? I encounter request limit last time. Im not sure if this type of request is not counted on that.
You'll probably hit it yes. To avoid that you'll have to use function
Recommended threads
- Custom API domain is unreachable
Earlier my custom api domain was working fine. Now it seems to be offline without a trace a few hours later. I didn't change anything, all the relevant DNS reco...
- "Invalid console fingerprint" when unpau...
I've tried logging out and logging back in, still can't figure out why this is happening.
- Inviting members while SMTP is disabled ...
Issue: https://github.com/appwrite/console/issues/3125 PR: https://github.com/appwrite/console/pull/3126