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
- Google OAuth2 is not working
the Google OAuth2 is working perfectly in localhost, but when I bring it to production that means real domain, then when I clicked button signin nothing happene...
- Trouble Creating Database and Collection...
Iβve set up my project credentials (endpoint, project ID) and generated an API key. Iβm currently focusing on creating only the database and collections (tables...
- DOWN GRADING FROM PRO
I previously subscribed to pro on one of my projects for trial but unfortunately ive been billed for this month, my aim was to try pro for one month, is there ...