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