Add function to connect to the MongoDB database
See #2