Cleanup
This commit is contained in:
1
node_modules/mongoose/lib/options/PopulateOptions.js
generated
vendored
1
node_modules/mongoose/lib/options/PopulateOptions.js
generated
vendored
@@ -5,6 +5,7 @@ const clone = require('../helpers/clone');
|
||||
class PopulateOptions {
|
||||
constructor(obj) {
|
||||
this._docs = {};
|
||||
this._childDocs = [];
|
||||
|
||||
if (obj == null) {
|
||||
return;
|
||||
|
||||
20
node_modules/mongoose/lib/options/SchemaArrayOptions.js
generated
vendored
20
node_modules/mongoose/lib/options/SchemaArrayOptions.js
generated
vendored
@@ -32,6 +32,26 @@ const opts = require('./propertyOptions');
|
||||
|
||||
Object.defineProperty(SchemaArrayOptions.prototype, 'enum', opts);
|
||||
|
||||
/**
|
||||
* If set, specifies the type of this array's values. Equivalent to setting
|
||||
* `type` to an array whose first element is `of`.
|
||||
*
|
||||
* ####Example:
|
||||
*
|
||||
* // `arr` is an array of numbers.
|
||||
* new Schema({ arr: [Number] });
|
||||
* // Equivalent way to define `arr` as an array of numbers
|
||||
* new Schema({ arr: { type: Array, of: Number } });
|
||||
*
|
||||
* @api public
|
||||
* @property of
|
||||
* @memberOf SchemaArrayOptions
|
||||
* @type Function|String
|
||||
* @instance
|
||||
*/
|
||||
|
||||
Object.defineProperty(SchemaArrayOptions.prototype, 'of', opts);
|
||||
|
||||
/*!
|
||||
* ignore
|
||||
*/
|
||||
|
||||
25
node_modules/mongoose/lib/options/SchemaNumberOptions.js
generated
vendored
25
node_modules/mongoose/lib/options/SchemaNumberOptions.js
generated
vendored
@@ -67,6 +67,31 @@ Object.defineProperty(SchemaNumberOptions.prototype, 'max', opts);
|
||||
|
||||
Object.defineProperty(SchemaNumberOptions.prototype, 'enum', opts);
|
||||
|
||||
/**
|
||||
* Sets default [populate options](/docs/populate.html#query-conditions).
|
||||
*
|
||||
* ####Example:
|
||||
* const schema = new Schema({
|
||||
* child: {
|
||||
* type: Number,
|
||||
* ref: 'Child',
|
||||
* populate: { select: 'name' }
|
||||
* }
|
||||
* });
|
||||
* const Parent = mongoose.model('Parent', schema);
|
||||
*
|
||||
* // Automatically adds `.select('name')`
|
||||
* Parent.findOne().populate('child');
|
||||
*
|
||||
* @api public
|
||||
* @property populate
|
||||
* @memberOf SchemaNumberOptions
|
||||
* @type Object
|
||||
* @instance
|
||||
*/
|
||||
|
||||
Object.defineProperty(SchemaNumberOptions.prototype, 'populate', opts);
|
||||
|
||||
/*!
|
||||
* ignore
|
||||
*/
|
||||
|
||||
25
node_modules/mongoose/lib/options/SchemaObjectIdOptions.js
generated
vendored
25
node_modules/mongoose/lib/options/SchemaObjectIdOptions.js
generated
vendored
@@ -31,6 +31,31 @@ const opts = require('./propertyOptions');
|
||||
|
||||
Object.defineProperty(SchemaObjectIdOptions.prototype, 'auto', opts);
|
||||
|
||||
/**
|
||||
* Sets default [populate options](/docs/populate.html#query-conditions).
|
||||
*
|
||||
* ####Example:
|
||||
* const schema = new Schema({
|
||||
* child: {
|
||||
* type: 'ObjectId',
|
||||
* ref: 'Child',
|
||||
* populate: { select: 'name' }
|
||||
* }
|
||||
* });
|
||||
* const Parent = mongoose.model('Parent', schema);
|
||||
*
|
||||
* // Automatically adds `.select('name')`
|
||||
* Parent.findOne().populate('child');
|
||||
*
|
||||
* @api public
|
||||
* @property populate
|
||||
* @memberOf SchemaObjectIdOptions
|
||||
* @type Object
|
||||
* @instance
|
||||
*/
|
||||
|
||||
Object.defineProperty(SchemaObjectIdOptions.prototype, 'populate', opts);
|
||||
|
||||
/*!
|
||||
* ignore
|
||||
*/
|
||||
|
||||
28
node_modules/mongoose/lib/options/SchemaStringOptions.js
generated
vendored
28
node_modules/mongoose/lib/options/SchemaStringOptions.js
generated
vendored
@@ -87,30 +87,52 @@ Object.defineProperty(SchemaStringOptions.prototype, 'uppercase', opts);
|
||||
* If set, Mongoose will add a custom validator that ensures the given
|
||||
* string's `length` is at least the given number.
|
||||
*
|
||||
* Mongoose supports two different spellings for this option: `minLength` and `minlength`.
|
||||
* `minLength` is the recommended way to specify this option, but Mongoose also supports
|
||||
* `minlength` (lowercase "l").
|
||||
*
|
||||
* @api public
|
||||
* @property minlength
|
||||
* @property minLength
|
||||
* @memberOf SchemaStringOptions
|
||||
* @type Number
|
||||
* @instance
|
||||
*/
|
||||
|
||||
Object.defineProperty(SchemaStringOptions.prototype, 'minLength', opts);
|
||||
Object.defineProperty(SchemaStringOptions.prototype, 'minlength', opts);
|
||||
|
||||
/**
|
||||
* If set, Mongoose will add a custom validator that ensures the given
|
||||
* string's `length` is at most the given number.
|
||||
*
|
||||
* Mongoose supports two different spellings for this option: `maxLength` and `maxlength`.
|
||||
* `maxLength` is the recommended way to specify this option, but Mongoose also supports
|
||||
* `maxlength` (lowercase "l").
|
||||
*
|
||||
* @api public
|
||||
* @property maxlength
|
||||
* @property maxLength
|
||||
* @memberOf SchemaStringOptions
|
||||
* @type Number
|
||||
* @instance
|
||||
*/
|
||||
|
||||
Object.defineProperty(SchemaStringOptions.prototype, 'maxLength', opts);
|
||||
Object.defineProperty(SchemaStringOptions.prototype, 'maxlength', opts);
|
||||
|
||||
/**
|
||||
* Sets default [populate options](/docs/populate.html#query-conditions).
|
||||
*
|
||||
* @api public
|
||||
* @property populate
|
||||
* @memberOf SchemaStringOptions
|
||||
* @type Object
|
||||
* @instance
|
||||
*/
|
||||
|
||||
Object.defineProperty(SchemaStringOptions.prototype, 'populate', opts);
|
||||
|
||||
/*!
|
||||
* ignore
|
||||
*/
|
||||
|
||||
module.exports = SchemaStringOptions;
|
||||
module.exports = SchemaStringOptions;
|
||||
|
||||
3
node_modules/mongoose/lib/options/SchemaTypeOptions.js
generated
vendored
3
node_modules/mongoose/lib/options/SchemaTypeOptions.js
generated
vendored
@@ -134,8 +134,7 @@ Object.defineProperty(SchemaTypeOptions.prototype, 'select', opts);
|
||||
|
||||
/**
|
||||
* If [truthy](https://masteringjs.io/tutorials/fundamentals/truthy), Mongoose will
|
||||
* build an index on this path when the model is
|
||||
* compiled.
|
||||
* build an index on this path when the model is compiled.
|
||||
*
|
||||
* @api public
|
||||
* @property index
|
||||
|
||||
Reference in New Issue
Block a user