(#1658) - integrate persistent mapreduce

This commit ensures that the persisted map/reduce
indexes are destroyed when their parent database
is destroyed. All tests are passing in all three
adapters.
(#1658) - use promises for upsert