Changed the model lookup to refect the actual model database.

Mongoosejs supports multiple connections, hence the use of the actual db object in the model structure to lookup the model types. Without this patch, this module is incompatible with mongoose.createConnection().