Friendship modelling for Meteor


I am new to Meteor and noSQL databases.

I am trying to create a simple friendship model and would use the following setup

Collection 1: Friends
Contains: User1, User2, Date

Collection 2: Notifications
Contains (amongst other things): …FriendNotification: [{from: “User”, accepted: false}],…

Note: Idea is once the notifications gets accepted the actual entry in the Friends collection is created

I read that in Mongo for example you should just add a friends array to the user object. However according to the Discover Meteor guys embedding something that large is not a good option. That’s why I thought creating an extra friends collection is a better idea.

Any comments are greatly appreciated

Haha, @shock beat me to it


Thanks for the quick replies,

I have seen this package, but it is kind of difficult to understand for beginners, I haven’t seen any tutorial or guides / how-to regarding the socialize packages.

Will look through it though and I’m sure it’ll make sense.

I just took about an hour to actually look at the package a bit more in depth and I have to say this is really cool @copleykj

One minor question I have is why userId is optional for all of the three collections.
Don’t I need a userId for the Friend collection for example?

I will definitely use this to integrate it in my app…I’ll let you know how it goes :slight_smile:

@shibbn The optional on userId is a remnant of my misunderstanding how autovalues worked in simple-schema when I first wrote the package. It doesn’t affect anything but really should be removed just to avoid confusion.

As for the package and the socialize packages in general, they are really designed to be dead simple to use. At this point they are a bit lacking in documentation and example usage which should change as soon as I have a bit of time to update that. Pull requests for that sort of thing are also very welcome.