To query documents by ObjectID, you can’t just pass in a string, you need to send in PHP’s Object/Type MongoID
public function action_getstuff()
{
$mongodb= \Mongo_Db::instance('default');
$userID1 = '4f98c2f6f26c618f21000002';
$userID2 = '4f976a38f26c619121000002';
$result = $mongodb->where_in('_id', array($userID1, $userID2))->get('Users');
if($result)
{
echo "got Results with userID strings";
}
$result = null;
$mongoID1 = new MongoID($userID1);
$mongoID2 = new MongoID($userID2);
$result = $mongodb->where_in('_id', array($mongoID1, $mongoID2))->get('Users');
if($result)
{
echo "got Results with MongoID objects";
}
}
You should get results on the 2nd query with the MongoID objects.
If you are in your Model, and using a namespace, remember to reference the MongoID object with \MongoID