How to select certain fields with mongodb doctrine in symfony2
You will need to use QueryBuilder with the select
operator:
$result = $dm->createQueryBuilder('User')->select('field1', 'field2')->field('field3')->equals('somevalue')->getQuery()->execute();
http://docs.doctrine-project.org/projects/doctrine-mongodb-odm/en/latest/reference/query-builder-api.html