I wonder if there is an equivalent to the MySQL-Query:
SELECT COUNT(*) FROM users
in MongoDB ODM?
This might work:
$qb = $this->dm->createQueryBuilder('Documents\Functional\Users');
$qb->select('id');
$query = $qb->getQuery();
$results = $query->execute();
echo $query->count();
But aren't then all IDs returned and how does this affect performance if there are more complex documents in database. I don't want too send to much data around just to get a count.