Handled potential uncaught error in mongo.js