store the chat data into mongodb