I m trying to make a query in PHP with the MongoDB\Driver\Query class but with the doc in php.net I didn't really understand how to make it work. I would like to return a JSON object with all data of my collection.
This for a function PHP running with Php 7.1.2 and MongoDB 3.2.20
$m = new MongoDB\Driver\Manager("mongodb://login:password@127.0.0.1:27017/");
$filter = array('id' => 0);
$options = array(
'projection' => ['name' => $parameters['baseName']]
);
$query = new MongoDB\Driver\Query($filter, $options);
$cursor = $m->executeQuery(''db_name.my_collection', $query);
$myJson = json_decode(json_encode($cursor),true);