objectid is not defined code example Example: objectid is not defined node js mongodb var ObjectId = require('mongodb').ObjectID;