created and called the method 'ConnectToMongo()' for connecting to the mongo server.