added mongodb connection logic.