added tests and implementation for connecting to mongo databases with password protection