mongoose
Version:
Mongoose MongoDB ODM
31 lines (24 loc) • 544 B
JavaScript
/**
* ObjectId type constructor
*
* ####Example
*
* var id = new mongoose.Types.ObjectId;
*
* @constructor ObjectId
*/
;
const ObjectId = require('../driver').get().ObjectId;
const objectIdSymbol = require('../helpers/symbols').objectIdSymbol;
/*!
* Getter for convenience with populate, see gh-6115
*/
Object.defineProperty(ObjectId.prototype, '_id', {
enumerable: false,
configurable: true,
get: function() {
return this;
}
});
ObjectId.prototype[objectIdSymbol] = true;
module.exports = ObjectId;