randomcoding/PartsDbWebApp — Issue #29: Migrate All MongoDB to use the LiftWeb Mongo API
Author: randomcoder
Created: 2012-01-21 13:00:37+00:00
State: open

In order to provide a future proof means of adding/retrieving documents to/from the MongoDB, we need to stop using the basic JSON conversion classes and use a consistent API layer.

There are a couple of options, but I think it boils down to two main choices:

## Casbah
This does not provide any direct API for the conversion of MongoDB -> Scala Obejcts so each object needs to be mapped by us. This does allow us complete flexibility and makes the process of conversion quite transparent. However, there might be a reasonable overhead in the initial creation and maintenance of this approach, especially if object structures change and require several conditional checks to be made in the conversion process.

Casbah is currently used as the underlying MongoDB access library, so

## LiftWeb API
Lift provides a built in [MongoDB API](http://www.assembla.com/spaces/liftweb/wiki/MongoDB) which has (apparently) had some updates for 2.4. This seems to include a full conversion api, but would mean that we would need to migrate all the current MongoDB access code to use the new API.

The LiftWeb API seems like the better choice overall, but would involve more work upfront.