Rogue: A Scala Type-Safe MongoDB DSL 2012-06-22
Recently our group has been debating about switching to MongoDB. As a number of our analysis tools are written in Scala, naturally we'd like a Scala or Java ORM.
After some search, we've decided to explore Rogue, a type-safe DSL for querying MongoDB. Here's some motivation from the Foursquare engineers for developing Rogue, after using Lift for their ORM:
Essentially, we found the querying support a bit too expressive — you can pass in a query object that doesn’t represent a valid query, or query against fields that aren’t part of the record. And in addition it isn’t very type-safe. You can ask for, say, all Venue records where mayor = “Bob”, and it happily executes that query for you, returning nothing, never informing you that the mayor field is not a String but a Long representing the ID of the user. Well, we thought we could use the Scala type system to prevent this from ever happening, and that’s what we set out to do.
Setting Up MongoDB on Ubuntu 11.10 2012-06-28
MongoDB is fairly easy to install on Ubuntu so this guide will hit the essentials and provide links for more details.
Install
Configuration
I've installed my OS and /home on different partitions to make reinstalling the OS easier. So let's keep the config file and data/logs on the /home partition.
# in ~ or wherever you want to put mongodb's files
mkdir mongodb
cd mongodb
mkdir db log # Create data/log folders
# Create a copy of conf file
cp /etc/init/mongodb.conf .