If you are using v3.0 mongodb for Node.js you should use the new API as follows, and the MongoDB Atlas URI connection string for driver 3.4 and earlier:
MongoClient.connect(uri, function(err, client) {
console.log("Connected successfully to server");
const db = client.db(dbName);
});