Chat server code in node.js with use of mongo db