Is it possible to issue a count() query, with several conditions, using salat library?
right now I'm just doing something like
def countByPoll(pollId: String, option: Int): Int = {
dao.find(
MongoDBObject("pollId" -> pollId, "option" -> option)
).size
}
But I'm sure a count would perform much better
I had a look at salat sources and it was easier than expected
def countByPoll(pollId: String, option: Int): Long = {
dao.count(MongoDBObject("pollId" -> pollId, "option" -> option))
}