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).