You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
544 B
31 lines
544 B
4 years ago
|
/**
|
||
|
* ObjectId type constructor
|
||
|
*
|
||
|
* ####Example
|
||
|
*
|
||
|
* var id = new mongoose.Types.ObjectId;
|
||
|
*
|
||
|
* @constructor ObjectId
|
||
|
*/
|
||
|
|
||
|
'use strict';
|
||
|
|
||
|
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;
|