Creating following/follower feature in a social app - Database structure and feature implementation
- 0
- Databases
- Apple
Hi! I’m working on a social media app. I’m planning on using Appwrite to sign-up users. I would like to implement a following/follower/friend feature; a friend would be someone you follow that also follows you.
What would be the ideal way to structure this in an Appwrite database?
Should the following/followers be: array attributes on a user document, in it's own collection, or another way?
Also, how best to get the friends from a user's followers/following?
I would create a collection called following or something with two attributes: the id of the follower and the id of the person that follower is following
Thanks so much. So to get the followers, following, and friends would it involve doing the following:
Following: get all documents for which the user is the follower.
Followers: get all documents for which the user is the followee (person that someone is following).
Friends: on the client side, get the uuids from following and followers then use a set operation (intersection) to get the friends.
Is there a better way to do this? In particular for getting the friends?
You can have another collection for friends that is auto populated based on the following collection by an Appwrite function that executed automatically when someone follows or unfollows
Recommended threads
- Relationship data Not showing on update ...
Version : 1.9.0 OS/System : Windows10/Docker Database : MongoDB Clean Zero Installation The first thing I did in the testing process was create a category and...
- I lost my account, only thing i have is ...
So i had this project on appwrite for my web project called Islami zindagi, but i havent used it in a while, now i tried to login, but i could not remember the ...
- 403 The current user has been blocked.
Hello, I have a free plan; I've tried to access my project and I get the message "403 The current user has been blocked." I have database, sites, and auth in us...