init function to connect to mongo