ReactiveMongo-Queries is available on sonatype.org.
If you use ReactiveMongo 0.10.0, you just have to edit build.sbt and add the following:
resolvers += "Sonatype Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots/"
libraryDependencies ++= Seq(
"com.github.ReactiveMongo-Queries" %% "reactivemongo-queries" % "0.10.0.a-SNAPSHOT"
)
There's a version for 0.10.5.akka23-SNAPSHOT
resolvers += "Sonatype Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots/"
libraryDependencies ++= Seq(
"com.github.ReactiveMongo-Queries" %% "reactivemongo-queries" % "0.10.5.a-SNAPSHOT"
)
Sample project https://github.com/sh1ng/ReactiveMongo-Queries-Sample
Suppose we query employees with below structure
case class Contacts(email: String, phone: String)
case class Employee(name: String, contacts: Contacts, salary: Int)
without Queries
collection.find(BSONDocument("name" -> "john"))
with Queries
import reactivemongo.queries.Query._
collection.find(on[Employee].eq(_.name, "john"))
without Queries
collection.find(BSONDocument("contacts.email" -> "john@company.com"))
with Queries
import reactivemongo.queries.Query._
collection.find(on[Employee].eq(_.contacts.email, "john@company.com"))
without Queries
collection.update.find(BSONDocument("salary" -> BSONDocument("$gt" -> 100000)))
with Queries
import reactivemongo.queries.Query._
collection.find(on[Employee].gt(_.salary, 100000))
without Queries
collection.update.find(BSONDocument("salary" -> BSONDocument("$lt" -> 50000)),
BSONDocument("$mul" -> BSONDocument("salary" -> 1.1)))
with Queries
import reactivemongo.queries.Query._
collection.update(on[Employee].lt(_.salary, 50000),
on[Employee].update(_.mul(_.salary, 1.1)))