What I need:
Suppose you\'re using MongoDB and you have a collection called users
, and each user has a \"following\" array with user
I can't see any other way too, i implemented such thing before and didn't have a problem.
On your case, it should be sth like this, you pass certain user's $follower_ids
array as an argument to your function:
$query = array("status_owner_id" => array('$in' => $follower_ids));
$cursor = $mongo->yourdb->statuses->find($query);
And if you index statuses (if you have enough ram to do so) upon owner_id you'd get the results really fast.
Hope it helps, Sinan.