codebrew/resourceful-mongo — pull request #2 by brenden (2012-03-15 22:03:31+00:00)
Title: Various Changes

Hi codebrew team,

Here are a couple of changes I've made in an effort to bring resourceful-mongo a bit closer to a production-ready state. Sorry to stuff all of this into a single pull request.

### Implementation changes

* A single mongo connection is opened per database. It is re-used from operation to operation
* A single mongo collection object is created per resource and then reused for each operation

### Interface changes

* If an object is passed to get() instead of an ID string, it will treat the object as the condition to a findOne query
* Likewise, updating and removing can be performed by using a query object, in addition to just using an ID
* Defining resources and opening a database connection are two separate steps (see README changes)