Fix for couchdb error.
Updated couch/mongo function signatures and ensure events are thrown