Refactor Mongo driver code to be less callbacky.