I'd like to generate a MongoDB ObjectId with Mongoose. Is there a way to access the ObjectId constructor from Mongoose?
Yes, you can find the ObjectId constructor on require('mongoose').Types. Here is an example:
var mongoose = require('mongoose');
var id = mongoose.Types.ObjectId();
id is a newly generated ObjectId.
You can read more about the Types object at Mongoose#Types documentation.