geddy/model — pull request #230 by mshick (2014-09-16 00:47:37+00:00)
Title: Explicit connect / disconnect in level adapter, etc

Sorry, I ended up with a less clean PR than I would have liked, got a little rushed on the project I was using this for.

Here I'm changing:

* Options removes the extra "multilevel" property, and moves those properties up to the main options object. This is because the extra options don't interfere, and it brings better parity with other adapters.
* If a model is loaded and does not have an id property, I set the id property to the key that was loaded. Model assumes id=key, but in Level the key is actually the required param. I noticed the mongo adapter does something similar, setting the "id" to the true "_id". I found this useful for getting Model to hook into data Model didn't necessarily create.
* I made the `connect` method actually do the connecting for multilevel. This allows you to provision the models, and then connect the adapters as a separate action. Again, I'm following the Mongo adapter here.
* The `connect` process is now more robust, actually waiting for a connection before emitting an error or a connect, performing auth, and setting the adapter db.
* The `disconnect` method now closes the db.