I try:
$fields = array('name'=>true);
find (array(array(), $fields))
but it's not working (I get nothing) and I can't see my mistake. Sorry :(
The PHP function for find does not work like that. Try:
find(array(), array('name'=>1))
(basically omit the surrounding array)
For reference here is the documentation page: http://php.net/manual/en/mongocollection.find.php
If you are looking for a specific field in all your records you can do something like this:
$cursor = $collection->find();
foreach( $cursor->fields(array('myField' => true )) as $doc ) {
echo "<pre>";
var_dump($doc);
echo "</pre>";
This would return only 'myFeild' for each document in the collection.