Hi i’m doing a project where user can follow other users and see the activities of them.
For now i’ ve done 2 collections that have this schema
Schema.Activity = new SimpleSchema({
actionType: {
type: Number
}
userId: {
type: String
},
createdAt: {
type: Date
}
});
Schema.User = new SimpleSchema({
....
followedBy: { // array of user._id
type: [String],
optional: true
}
});
With this schema, How can i select the last activities of users that a user follows?
In sql it would be something like:
"SELECT actions.* FROM actions INNER JOIN users ON actions.userId = users._id
WHERE " + currentUserId + " IN (users.followedBy) "
What is the better method for do it with meteor?
Thanks!