doctrine/mongodb-odm — pull request #543 by sergponomaryov (2013-03-29 13:18:25+00:00)
Title: PersistentCollection::count() improvements

`PersistentCollection::count()` method consumes too much memory and time when there are many referenced documents. It queries and hydrates referenced documents and uses `ArrayCollection::count()` method to get quantity of result elements instead of executing `count` command into database.

This PR improves `PersistentCollection::count()` method. New behavior:
* it executes database `count` command when collection is `InverseSide` and not inititalized yet
* uses `ArrayCollection::count()` method in an opposite way