Rogue is a type-safe internal Scala DSL for constructing and executing find and modify commands against MongoDB in the Lift web framework. Originally developed by Foursquare, then re-published as part of Foursquare monorepo
Sgrouples changes to the original
- Mongo java driver updated to version 3.2.x to support MongoDB version 3.2 and up
- Support for non-blocking IO via async functions like
fetchAsyncetc. Note that for really non-blocking io, you need to use MongoDB version 3.2 and higher, as earlier versions of Mongo don't have non-blocking protocol implemented, and in effect connection pool will be exhausted anyway
- Spindle support is not implemented, as we don't use it internally
- Build is standard sbt instead of pants
Building and installing
Standard sbt build, so just
sbt package; sbt publish-local is enough.
- define your model as a case class
_ can be eny of supported types or a case class - so nesting is allowed.
Enumerations are handled separately - you need to import either
me.sgrouples.rogue.EnumNameFormats._ if you want to serialize Enumeration names or
me.sgrouples.rogue.EnumValueFormats._ if you want to serialize integers.
Default values handling: if database lacks value that can be deserialized into required format, a default value is provided, those are, 0 of specific type or empty. This is a heritage from Lift Active record, and might be changed in the future.
RCcMeta[CC]object with definition of your fields. They must match case class fields
Create connection to Mongo and put it on
+ sbt publishSigned
+ sbt sonatypeRelease