Refactor configuring of mongo driver from json, add some tests.