It must be a better way to do this? I want to get all documents from the sounds collection and output them with an array with objects in (using it for backbone.js). It cant be an object with objects in!
$sounds = iterator_to_array($db->sounds->find());
$a = "[";
foreach ($sounds as $id => $sound) {
$a .= json_encode($sound) . ",";
}
//remove the last comma...
$a = substr($a, 0, -1);
$a .="]";
echo $a;
echo json_encode(array_values($sounds));?