I'm new here. I'm trying to search multiple ObjectIds in MongoDB using '$in' under PHP. And it runs OK on RockMongo. but it seems no luck in my own PHP codes.
Here is what I did.
In RockMongo
{
_id: {'$in': [ ObjectId("54c8a7446abe4688010041ae"), ObjectId("54c8a7446abe4688010041ad") ]}
}
In PHP
$tagsDB = self::getTagsDB();
$res = $tagsDB->find(array(
'_id' => array('$in' => $tagIds)
));
$tagsDB
is MongoClient connection and $res
gives me MongoCursor::__set_state(array( ))
$tagIds
is an array of ObjectId
.
If you could help me out, that would be great! Please let me know if I need to provide further information.
best,