refactor(many): Add wrapper around mongo connection

Main fix:
Write wrapper to handle database disconnections and to do auto-retries when db is disconnected.

Also:
rewrite promises to be cleaner,
add .done and .finally statements instead of only .catch statements
fix up various parts of the code to be cleaner.