I have a simple record that should return based on a query. As soon as I try to get the results I get the following error:
Cursors cannot yield multiple iterators
The code I have is very simple:
$db = \core\databaseUtilities\getDbConnection();
$filter = [ 'email' => $email ];
$query = new \MongoDB\Driver\Query($filter);
$res = $db->executeQuery($db->dbName.".users", $query);
$records = $res->toArray();
It fails on the last line.
I found some code examples on the web on how to query on they all pretty much looked the same. Here is the reference I used: http://php.net/manual/en/class.mongodb-driver-cursor.php