(daleharvey/pouchdb#1658) - register dependent dbs

This ensures that map/reduce's dependent dbs
are registered, so that PouchDB can clean them
up when their parent databases are destroyed.
(#1658) - use promises for upsert