Version 7, last updated by eltimn at 24 Feb 21:03 UTC

Installation

SBT users

Add dependency to your project description:

val lift_mongo = "net.liftweb" %% "lift-mongodb" % "2.4"

Maven users

Add dependency to your pom:

<dependency>
  <groupId>net.liftweb</groupId>
  <artifactId>lift-mongodb</artifactId>
  <version>2.4</version>
</dependency>

More Information

You could also create your Mongo documents using the DSL:

import net.liftweb.json._
import net.liftweb.json.JsonAST.JObject
import net.liftweb.json.JsonDSL._
implicit val formats = DefaultFormats.lossless
val json = JsonParser.parse("""
{ "name": "joe",
	"children": [
		{
		  "name": "Mary",
		  "age": 5
		},
		{
		  "name": "Mazy",
		  "age": 3
		}
	]
}
""").asInstanceOf[JObject]
MongoDB.useCollection("myCollection")( coll => {
	coll.save(JObjectParser.parse(json))
})