//Just add this line of code and client.connect and //-other dot functions will work var mongo = require('mongodb').MongoClient;