O'Reilly logo

Lift Application Development Cookbook by Gilberto T. Garcia Jr.

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

Connecting to MongoDB using record

In this recipe, we will see how we can use record to connect our Lift application to a MongoDB database.

Getting ready

Before starting with this recipe, you will need to install MongoDB on your computer. You can download the appropriate installer for your OS from http://www.mongodb.org/downloads, and you can find installation instructions specific to your OS at http://docs.mongodb.org/manual/installation/.

How to do it...

  1. Start a new blank project.
  2. Edit the build.sbt file and add the following dependencies:
    "net.liftweb"
           %% "lift-mongodb"         % liftVersion                  % "compile->default" withSources(),
    "net.liftweb"
           %% "lift-mongodb-record"  % liftVersion                  % "compile->default" withSources()
  3. Add the following import statements in the ...

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