I am trying to create a newsfeed and I am trying to conjure up the best way (or algorithm in a sense) to get a bunch of Objects a user is subscribed to in with mongoose and then return the latest updates ordered chronologically from all those objects:
ie. with mongoose schemas:
var UserSchema = new Schema({
subscribed: [ObjectSchema]
});
var ObjectSchema = new Schema({
updates: [UpdateSchema]
});
var UpdateSchema = new Schema({
date_updated: Date,
message: String
});
Thanks in advance!
You already have the answer. You just have to find all the updates sorted by the date_updated property.
Maybe I didn't understood your question but as asked, you just have to do that. Tell me if you wanted something else.