How do I get JSON string from Mongo db using Play (and Salat)?
How do I get the plain JSON from Mongo DB using Play? (Currently I'm
accessing Mongo with Salat because it's the only way I have found yet).
I have currently:
MyEntry.findAll()
Where findAll returns a SalatMongoCursor - I can call something on it like
mkString, this shows all the entries but not in JSON format.
Don't want to loop over it or map, there must be a shorthand for this.
This is the dao:
object MyEntry extends ModelCompanion[MyEntry, ObjectId] {
val dao = new SalatDAO[MyEntry, ObjectId](collection =
mongoCollection("myEntries")) {}
}
Thanks in advance.
No comments:
Post a Comment