I have a JSON of this form from MongoDB and I want to retrieve documents based on same queries:
{
"_id" : ObjectId("5281fb3070c68c0c1ccc4f00"),
"channel" : "1",
"content" : "8578",
"duplicateOf" : null,
"id" : "7420",
"keywords" : [ObjectId("52816d3370c68c2c1c450500"), ObjectId("52816d3370c68c2c1c570500"), ObjectId("52816d3370c68c2c1c470500"), ObjectId("52816d3370c68c2c1c4d0500"), ObjectId("52816d3370c68c2c1c590500"), ObjectId("52816d3370c68c2c1c530500"), ObjectId("52816d3370c68c2c1c4f0500"), ObjectId("52816d3370c68c2c1c6b0500")],
"lastUpdate" : "2009-11-16"]
}
I use this query with MongoVue and it works :
db.Measurements.find({ "_id" :
{ "$in" : [ObjectId("5281fb3070c68c0c1ccc4f00"), ObjectId("5281fb3070c68c0c1cce4f00")] } })
but I don't find the way to make it work in PHP,here is the part of the code:
foreach ($series as $doc) {
$ids = $collectionMeasurements->find(array('_id' => array($in=>new MongoId($doc[keywords]))));
}
Thanks for your help!!!
===================================================== Found the error!!!
foreach ($series as $doc) {
$ids = $collectionMeasurements->find(array('_id' => array(
'$in'=>array(new MongoId(string)($doc[keywords])))));
}