1

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.

1 Answer 1

1

Edit : I found the answer. Wishing it could help someone:

foreach ($cursor['cursor']['firstBatch'] as $result) {
    echo "$result";
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.