Refactor mongodb connection

This refactoring to mongodb connection handling will solve:
1. username or password with special chars like @ won't be handled correctly to connect to mongodb via the connection string uri, so this refactor solves that
2. exit on mongodb error instead of hang the nodejs app idle
The user and pass can be specified in the URI, I would do it that way since it's the standard way.