Ugh, all this makes me think part of bson/json will need kind of revamp one day to provide way to do such typical tasks more efficiently.

On Sun, 21 Oct 2012 08:04:10 GMT, Sönke Ludwig wrote:

Hm.. I thought ~= was defined for Json, but for some reason I left it out in the initial commit of json.d. A workaround is of course to use an actual array:

Json[] arr;
foreach( doc; coll.find() )
    arr ~= doc.toJson();
auto json = Json(arr);

I'll look into why ~= is not defined.