To be clear: Not exactly Json[], but Json which is array internally.
On Sun, 21 Oct 2012 04:57:40 GMT, mist wrote:
May be this is the most stupid question ever, but: how can I build up a Json[] from collection.find()? ( not findOne )
MongoCursor provides only opApply and I can't find any way to grow Json[] length dynamically in foreach loop.On Wed, 17 Oct 2012 07:50:50 +0200, Sönke Ludwig wrote:
Am 10/17/2012 7:19 AM, schrieb mist:
After trying a lot of stuff from docs I can't find short and convenient
way to return result of collection.find() as a single Bson or Json
object from REST interface. What is a "default" way?Json restMethod() { return collection.findOne(BsonEmpty.Object).get!Json; // or return cast(Json)collection.findOne(BsonEmpty.Object); }
should work. I'll improve the Bson docs on that one and maybe add
toJson/fromJson methods to Bson, so that it can be used directly in the
REST interface (although with type info loss in that case).