O'Reilly logo

Play Framework Cookbook - Second Edition by Giancarlo Inductivo, Alexander Reelsen

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Utilizing MongoDB

For this recipe, we will explore how to utilize MongoDB, the popular NoSQL library, within a Play application. MongoDB is one of the most widely-used NoSQL databases, and it most certainly has been a viable option as a datastore for many modern web applications. We will be using the Scala module, play-plugins-salat, which is an Object relation mapping tool that uses the official MongoDB Scala driver Casbah. This will be a Scala-only recipe.

For more information about Casbah, please refer to https://github.com/mongodb/casbah.

How to do it…

Let's take the following steps:

  1. Run the foo_scala application with Hot-Reloading enabled:
        activator "~run"
    
  2. Declare play-plugins-salat as a project dependency in build.sbt:
     "se.radley" %% "play-plugins-salat" ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required