How to model a friend system with MongoDB?

1

I am creating a small social network and I need to create the share of friendships.

I have two ideas:

  • A Friendship collection containing the sender, recipient, and response fields and make a populate with mongoose.
  • Put a Friend object inside the user document containing that user's friends and make a populate with mongoose.
  • Which of these is better performing? Or is there a more effective way?

        
    asked by anonymous 19.12.2016 / 19:58

    0 answers