Reputation: 21
I query mongoDB through PHP. I make the following request:
cursor = $full_mappingsCollection->aggregate(array(
array('$match' => array('species'=>$organism)),
array('$project' => array('mapping_file'=>1,'species'=>1,'_id'=>0)),
array('$unwind'=>'$mapping_file'),
array('$match' => array('$or'=> array(
array('mapping_file.Transcript ID'=>new MongoRegex("/^$search/xi")),
array('mapping_file.Plaza ID'=>new MongoRegex("/^$search/xi"))
),
array('$project' => array("mapping_file"=>1,'species'=>1,'_id'=>0))
),
array('cursor' => ["batchSize" => 0]));
array_push($cursor_array, $cursor);
Before, I could display the results by iterating this way:
foreach ($cursor['result'] as $result) {
echo "$result";
}
Today the field "result" no longer exists and I don't know how to display my results.
Any help will be welcome.
Upvotes: 1
Views: 145
Reputation: 21
Edit : I found the answer. Wishing it could help someone:
foreach ($cursor['cursor']['firstBatch'] as $result) {
echo "$result";
}
Upvotes: 1