jini jini - 1 year ago 70
PHP Question

Convert a MongoCursor from ->find() to an array

$jokes = $collection->find();

How do I convert
into an array?

Answer Source

You can use PHP's iterator_to_array function, as suggested in example 1 of the MongoCursor docs:

$jokes = $collection->find();
$jokesArray = iterator_to_array($jokes);
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download