I am designing a news feed for a blog site. I am trying to design the feed so blogs with recent activity from your friends keeps those blogs on the top of your feed while feeds you have no participation in fall towards the bottom of the list. Basically, think of your Facebook feed but for Blogs.
Here is the current design I have but I'm open to suggestions to make this easier to select from:
{_id: 1,author: {first: "John", last: "Doe", id: 123},title: "This is a test post.",body: "This is the body of my post."date: new Date("Feb 1, 2013"),edited: new Date("Feb 2, 2013"),comments: [ { author: {first: "Jane", last: "Doe", id: 124}, date: new Date("Feb 2, 2013"), comment: "Awesome post." },],likes: [ { who: {first: "Black", last: "Smith", id: 125}, when: new Date("Feb 3, 2013") }],tagged: [ { who: {first: "Black", last: "Smith", id: 126}, when: new Date("Feb 4, 2013") }]}
Question 1: Assuming my friends have the ids 124 and 125, how do I select the feed so that the order of this post in the results is by them, not by user 126 that was tagged in the feed later.
Question 2: Is this single collection of blogs a good design or should I normalize actions into a separate collection?