connects to mongodb database