mongodb/mongo-php-driver — pull request #52 by azat (2012-03-15 11:15:37+00:00)
Title: Fix "iterator_to_array(MongoCursor, true)" return one element if "find(array(), array('_id' => 0))"

Fix `iterator_to_array(MongoCursor, true)` return one element if `find(array(), array('_id' => 0))`

Another words: if result doesn`t have "_id" field

With `iterator_to_array(MongoCursor, false)` all ok, but I don`t think that programmers expecting such behaviour

Code to reproduce:

test->not_existed_collection;
$coll->insert(array('foo' => 1));
$coll->insert(array('foo' => 2));

assert(count(iterator_to_array($coll->find(array(), array('_id' => 0)))) == iterator_count($coll->find(array(), array('_id' => 0))));

$coll->drop();