MongoQuery announce

25 views
Skip to first unread message

Mike Limansky

unread,
Nov 22, 2014, 2:43:43 PM11/22/14
to scala...@googlegroups.com
Hi all,

  I'm happy to announce MongoQuery.

  MongoQuery provides compile time string interpolator to create BSON objects. Both Casbah and ReactiveMongo are supported. Example:

import com.github.limansky.mongoquery.casbah._

val user = myCollectionDAO
.findOne(mq"{ username : $user }")

  NOTE: when you need to use '$' for MongoDB keywords you need to escape it with the second '$':

myCollectionDAO.update(mq"{ price : { $$gt : $maxPrice } }",
                       mq
"{ $$set : { price : $maxPrice } }",
                      
false, true)

  The release is published to Sonatype repo. To add it to your project add following dependency to your build.sbt:
"com.github.limansky" %% "mongoquery-casbah" % "0.2" // for Casbah users
"com.github.limansky" %% "mongoquery-reactive" % "0.2" // for ReactiveMongo user

To get more information check the project readme. https://github.com/limansky/mongoquery

--
Regards,
Mike.
Reply all
Reply to author
Forward
0 new messages