Make handling of mongodb config more robust

- Make sure hosts parameter is interpreted correctly
- Enable option to always specify an alias