refactor getting mongo client, check on unit tests if connection present