added mongodb support to save the chat messages