What I need:

Suppose you're using MongoDB and you have a collection called users, and each user has a "following" array with user _ids of the people he's following. Then you have another collection statuses, with each status containing the _id of its author. How do you display to a certain user all the statuses added by people he's following?

What I tried:

I put all the users _ids that the current user is following in an array (I'm using PHP), then I used it to find all the statuses by those users using $in.

The question:

Is this the best solution?

Edit
Report