1 To Many Relationship Doesn't Work

Hello everyone! I’m creating a friend feature where each user can have multiple friends, but a friend can only belong to one user (makes sense, right?). However, when I tried to update the user’s friends after the friend request is accepted, I noticed that I am unable to add a new friend to the user’s “Friends” property. I am only able to update it, making it work like a 1 to 1 relationship, which isn’t what I want.

I also tried using the Many to Many relationship, which allowed me to add multiple friends, but doesn’t allow me to access a singular record. I believe to 1 to Many should be the correct choice, but strangely it isn’t working.

If you know the solution to this problem, please let me know. Thanks!

If I understand what you want to do correctly, it’s basically a follower or friend system like any other social media app correct?

If that’s the case you want to have a user to user relationship that is many to many. Call one like followers and one following or something like that. Then you should be able to add and remove users from that.