finilizing code in mongo.js