How should I get whole collection from Mongodb which has about 10000 items by PHP script? I thought it is simple taks but it looks its not. I have this script to get all items from Mongodb:
public function setCadastralUnits()
{
$this->cadastralUnits = [];
$mongoCursor = $this->mongoCollection->find();
foreach ( $mongoCursor as $unit )
{
$this->cadastralUnits[$unit->id] = $unit;
}
}
But this trivial function which creates indexed array kills whole script. What is wrong with that?