I'm working on play 2.3 with reactive mongo play plugin. I want to query the db which should give me all the entries.
Below I have given a snippet. The next line to the comment "FIND ALL THE TAGS", is the place where I am trying to fetch all the tags. I am looking for something like findAll equivalent method like in Spring Data JPA.
def tagCollection: JSONCollection = db.collection[JSONCollection]("tags")
def findTags = Action.async {
// **FIND ALL THE TAGS**
val cursor: Cursor[Tag] = tagCollection.find(Json.obj("name" -> )).cursor[Tag]
val futureTagsList: Future[List[Tag]] = cursor.collect[List]()
val futureTagsJsonArray: Future[JsArray] = futureTagsList.map {
tags => Json.arr(tags)
}
futureTagsJsonArray.map {
tags => Ok(tags(0))
}
Also is there any library documentation available?