In the previous recipe, we learned how to connect a Lift application to a MongoDB database. Now, we will learn how to map a collection from MongoDB to a Scala class so we can use it to store and retrieve data into and from the MongoDB collection.
Let's modify the project from the previous recipe because it already has the connection configured.
Carry out the following steps:
Contact.scala
in the model
package using the following code:package code.model import net.liftweb.mongodb.record._ import net.liftweb.mongodb.record.field._ import net.liftweb.record.field.StringField class Contact extends MongoRecord[Contact] with ObjectIdPk[Contact] { def meta = Contact ...
No credit card required