mongodb and php: the find() command

Viewed 11

can someone tell me where is wrong; in theory it should have all the documents in the database, but it returns an empty array; which is why it can't be because I have several documents in my db, and if I use findOne(), it does return data. code...

$conexion = parent::conectar();
//Si la coleccion no existe mongodb lo crea automaticamente
$collection = $conexion->questions;
// $response = $collection->findOne();
$response = $collection->find(array('curso'=> $curso));
$response = json_encode($response);
return $response; // array()
0 Answers
Related