mongoose 6.2.9 → 6.2.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/browser.umd.js +2 -2
  3. package/lib/aggregate.js +36 -36
  4. package/lib/browser.js +4 -4
  5. package/lib/connection.js +21 -21
  6. package/lib/cursor/AggregationCursor.js +2 -2
  7. package/lib/cursor/QueryCursor.js +3 -3
  8. package/lib/document.js +36 -36
  9. package/lib/error/index.js +2 -2
  10. package/lib/helpers/populate/markArraySubdocsPopulated.js +1 -1
  11. package/lib/helpers/projection/hasIncludedChildren.js +1 -1
  12. package/lib/index.js +23 -23
  13. package/lib/model.js +83 -77
  14. package/lib/options/SchemaArrayOptions.js +2 -2
  15. package/lib/options/SchemaBufferOptions.js +1 -1
  16. package/lib/options/SchemaDateOptions.js +2 -2
  17. package/lib/options/SchemaDocumentArrayOptions.js +3 -3
  18. package/lib/options/SchemaMapOptions.js +2 -2
  19. package/lib/options/SchemaNumberOptions.js +3 -3
  20. package/lib/options/SchemaObjectIdOptions.js +2 -2
  21. package/lib/options/SchemaStringOptions.js +1 -1
  22. package/lib/options/SchemaSubdocumentOptions.js +2 -2
  23. package/lib/options/SchemaTypeOptions.js +3 -3
  24. package/lib/query.js +214 -223
  25. package/lib/schema/SubdocumentPath.js +2 -2
  26. package/lib/schema/array.js +2 -2
  27. package/lib/schema/boolean.js +4 -4
  28. package/lib/schema/buffer.js +3 -3
  29. package/lib/schema/date.js +7 -7
  30. package/lib/schema/decimal128.js +2 -2
  31. package/lib/schema/documentarray.js +3 -3
  32. package/lib/schema/mixed.js +2 -2
  33. package/lib/schema/number.js +6 -6
  34. package/lib/schema/objectid.js +4 -4
  35. package/lib/schema/string.js +14 -14
  36. package/lib/schema.js +28 -28
  37. package/lib/schematype.js +75 -67
  38. package/lib/types/ArraySubdocument.js +1 -1
  39. package/lib/types/DocumentArray/methods/index.js +2 -2
  40. package/lib/types/array/index.js +1 -1
  41. package/lib/types/array/methods/index.js +12 -12
  42. package/lib/types/buffer.js +1 -1
  43. package/lib/types/decimal128.js +1 -1
  44. package/lib/types/objectid.js +1 -1
  45. package/lib/types/subdocument.js +2 -2
  46. package/lib/virtualtype.js +3 -3
  47. package/package.json +10 -10
  48. package/types/index.d.ts +5 -3
package/lib/document.js CHANGED
@@ -268,7 +268,7 @@ Document.prototype.schema;
268
268
  * is handy for passing data to middleware without conflicting with Mongoose
269
269
  * internals.
270
270
  *
271
- * ####Example:
271
+ * #### Example:
272
272
  *
273
273
  * schema.pre('save', function() {
274
274
  * // Mongoose will set `isNew` to `false` if `save()` succeeds
@@ -326,7 +326,7 @@ Document.prototype.isNew;
326
326
  /**
327
327
  * Set this property to add additional query filters when Mongoose saves this document and `isNew` is false.
328
328
  *
329
- * ####Example:
329
+ * #### Example:
330
330
  *
331
331
  * // Make sure `save()` never updates a soft deleted document.
332
332
  * schema.pre('save', function() {
@@ -348,7 +348,7 @@ Object.defineProperty(Document.prototype, '$where', {
348
348
  /**
349
349
  * The string version of this documents _id.
350
350
  *
351
- * ####Note:
351
+ * #### Note:
352
352
  *
353
353
  * This getter exists on all documents by default. The getter can be disabled by setting the `id` [option](/docs/guide.html#id) of its `Schema` to false at construction time.
354
354
  *
@@ -389,7 +389,7 @@ Document.prototype.errors;
389
389
  * A string containing the current operation that Mongoose is executing
390
390
  * on this document. May be `null`, `'save'`, `'validate'`, or `'remove'`.
391
391
  *
392
- * ####Example:
392
+ * #### Example:
393
393
  *
394
394
  * const doc = new Model({ name: 'test' });
395
395
  * doc.$op; // null
@@ -841,11 +841,11 @@ function init(self, obj, doc, opts, prefix) {
841
841
  /**
842
842
  * Sends an update command with this document `_id` as the query selector.
843
843
  *
844
- * ####Example:
844
+ * #### Example:
845
845
  *
846
846
  * weirdCar.update({$inc: {wheels:1}}, { w: 1 }, callback);
847
847
  *
848
- * ####Valid options:
848
+ * #### Valid options:
849
849
  *
850
850
  * - same as in [Model.update](#model_Model.update)
851
851
  *
@@ -876,11 +876,11 @@ Document.prototype.update = function update() {
876
876
  /**
877
877
  * Sends an updateOne command with this document `_id` as the query selector.
878
878
  *
879
- * ####Example:
879
+ * #### Example:
880
880
  *
881
881
  * weirdCar.updateOne({$inc: {wheels:1}}, { w: 1 }, callback);
882
882
  *
883
- * ####Valid options:
883
+ * #### Valid options:
884
884
  *
885
885
  * - same as in [Model.updateOne](#model_Model.updateOne)
886
886
  *
@@ -922,7 +922,7 @@ Document.prototype.updateOne = function updateOne(doc, options, callback) {
922
922
  /**
923
923
  * Sends a replaceOne command with this document `_id` as the query selector.
924
924
  *
925
- * ####Valid options:
925
+ * #### Valid options:
926
926
  *
927
927
  * - same as in [Model.replaceOne](https://mongoosejs.com/docs/api/model.html#model_Model.replaceOne)
928
928
  *
@@ -947,7 +947,7 @@ Document.prototype.replaceOne = function replaceOne() {
947
947
  * automatically set `session` if you `save()` a doc that you got from a
948
948
  * query with an associated session.
949
949
  *
950
- * ####Example:
950
+ * #### Example:
951
951
  *
952
952
  * const session = MyModel.startSession();
953
953
  * const doc = await MyModel.findOne().session(session);
@@ -1514,7 +1514,7 @@ function _isManuallyPopulatedArray(val, ref) {
1514
1514
  /**
1515
1515
  * Sets the value of a path, or many paths.
1516
1516
  *
1517
- * ####Example:
1517
+ * #### Example:
1518
1518
  *
1519
1519
  * // path, value
1520
1520
  * doc.set(path, value)
@@ -1718,7 +1718,7 @@ Document.prototype.$__setValue = function(path, val) {
1718
1718
  /**
1719
1719
  * Returns the value of a path.
1720
1720
  *
1721
- * ####Example
1721
+ * #### Example
1722
1722
  *
1723
1723
  * // path
1724
1724
  * doc.get('age') // 47
@@ -1824,7 +1824,7 @@ Document.prototype.$__path = function(path) {
1824
1824
  *
1825
1825
  * _Very helpful when using [Mixed](https://mongoosejs.com/docs/schematypes.html#mixed) types._
1826
1826
  *
1827
- * ####Example:
1827
+ * #### Example:
1828
1828
  *
1829
1829
  * doc.mixed.type = 'changed';
1830
1830
  * doc.markModified('mixed.type');
@@ -1847,7 +1847,7 @@ Document.prototype.markModified = function(path, scope) {
1847
1847
  /**
1848
1848
  * Clears the modified state on the specified path.
1849
1849
  *
1850
- * ####Example:
1850
+ * #### Example:
1851
1851
  *
1852
1852
  * doc.foo = 'bar';
1853
1853
  * doc.unmarkModified('foo');
@@ -1867,7 +1867,7 @@ Document.prototype.unmarkModified = function(path) {
1867
1867
  /**
1868
1868
  * Don't run validation on this path or persist changes to this path.
1869
1869
  *
1870
- * ####Example:
1870
+ * #### Example:
1871
1871
  *
1872
1872
  * doc.foo = null;
1873
1873
  * doc.$ignore('foo');
@@ -1892,7 +1892,7 @@ Document.prototype.$ignore = function(path) {
1892
1892
  * A path `a` may be in `modifiedPaths()` but not in `directModifiedPaths()`
1893
1893
  * because a child of `a` was directly modified.
1894
1894
  *
1895
- * ####Example
1895
+ * #### Example
1896
1896
  * const schema = new Schema({ foo: String, nested: { bar: String } });
1897
1897
  * const Model = mongoose.model('Test', schema);
1898
1898
  * await Model.create({ foo: 'original', nested: { bar: 'original' } });
@@ -1915,7 +1915,7 @@ Document.prototype.directModifiedPaths = function() {
1915
1915
  * Useful for determining whether this subdoc will get stripped out by the
1916
1916
  * [minimize option](/docs/guide.html#minimize).
1917
1917
  *
1918
- * ####Example:
1918
+ * #### Example:
1919
1919
  * const schema = new Schema({ nested: { foo: String } });
1920
1920
  * const Model = mongoose.model('Test', schema);
1921
1921
  * const doc = new Model({});
@@ -2048,7 +2048,7 @@ Document.prototype[documentModifiedPaths] = Document.prototype.modifiedPaths;
2048
2048
  *
2049
2049
  * If `path` is given, checks if a path or any full path containing `path` as part of its path chain has been modified.
2050
2050
  *
2051
- * ####Example
2051
+ * #### Example
2052
2052
  *
2053
2053
  * doc.set('documents.0.title', 'changed');
2054
2054
  * doc.isModified() // true
@@ -2094,7 +2094,7 @@ Document.prototype[documentIsModified] = Document.prototype.isModified;
2094
2094
  /**
2095
2095
  * Checks if a path is set to its default.
2096
2096
  *
2097
- * ####Example
2097
+ * #### Example
2098
2098
  *
2099
2099
  * MyModel = mongoose.model('test', { name: { type: String, default: 'Val '} });
2100
2100
  * const m = new MyModel();
@@ -2128,7 +2128,7 @@ Document.prototype.$isDefault = function(path) {
2128
2128
  /**
2129
2129
  * Getter/setter, determines whether the document was removed or not.
2130
2130
  *
2131
- * ####Example:
2131
+ * #### Example:
2132
2132
  * const product = await product.remove();
2133
2133
  * product.$isDeleted(); // true
2134
2134
  * product.remove(); // no-op, doesn't send anything to the db
@@ -2158,7 +2158,7 @@ Document.prototype.$isDeleted = function(val) {
2158
2158
  /**
2159
2159
  * Returns true if `path` was directly set and modified, else false.
2160
2160
  *
2161
- * ####Example
2161
+ * #### Example
2162
2162
  *
2163
2163
  * doc.set('documents.0.title', 'changed');
2164
2164
  * doc.isDirectModified('documents.0.title') // true
@@ -2214,7 +2214,7 @@ Document.prototype.isInit = function(path) {
2214
2214
  /**
2215
2215
  * Checks if `path` was selected in the source query which initialized this document.
2216
2216
  *
2217
- * ####Example
2217
+ * #### Example
2218
2218
  *
2219
2219
  * const doc = await Thing.findOne().select('name');
2220
2220
  * doc.isSelected('name') // true
@@ -2295,7 +2295,7 @@ Document.prototype.$__isSelected = Document.prototype.isSelected;
2295
2295
  * Checks if `path` was explicitly selected. If no projection, always returns
2296
2296
  * true.
2297
2297
  *
2298
- * ####Example
2298
+ * #### Example
2299
2299
  *
2300
2300
  * Thing.findOne().select('nested.name').exec(function (err, doc) {
2301
2301
  * doc.isDirectSelected('nested.name') // true
@@ -2357,11 +2357,11 @@ Document.prototype.isDirectSelected = function isDirectSelected(path) {
2357
2357
  /**
2358
2358
  * Executes registered validation rules for this document.
2359
2359
  *
2360
- * ####Note:
2360
+ * #### Note:
2361
2361
  *
2362
2362
  * This method is called `pre` save and if a validation rule is violated, [save](#model_Model-save) is aborted and the error is returned to your `callback`.
2363
2363
  *
2364
- * ####Example:
2364
+ * #### Example:
2365
2365
  *
2366
2366
  * doc.validate(function (err) {
2367
2367
  * if (err) handleError(err);
@@ -2826,11 +2826,11 @@ function _handlePathsToSkip(paths, pathsToSkip) {
2826
2826
  /**
2827
2827
  * Executes registered validation rules (skipping asynchronous validators) for this document.
2828
2828
  *
2829
- * ####Note:
2829
+ * #### Note:
2830
2830
  *
2831
2831
  * This method is useful if you need synchronous validation.
2832
2832
  *
2833
- * ####Example:
2833
+ * #### Example:
2834
2834
  *
2835
2835
  * const err = doc.validateSync();
2836
2836
  * if (err) {
@@ -3065,7 +3065,7 @@ function _checkImmutableSubpaths(subdoc, schematype, priorVal) {
3065
3065
  * Saves this document by inserting a new document into the database if [document.isNew](/docs/api.html#document_Document-isNew) is `true`,
3066
3066
  * or sends an [updateOne](/docs/api.html#document_Document-updateOne) operation **only** with the modifications to the database, it does not replace the whole document in the latter case.
3067
3067
  *
3068
- * ####Example:
3068
+ * #### Example:
3069
3069
  *
3070
3070
  * product.sold = Date.now();
3071
3071
  * product = await product.save();
@@ -3073,7 +3073,7 @@ function _checkImmutableSubpaths(subdoc, schematype, priorVal) {
3073
3073
  * If save is successful, the returned promise will fulfill with the document
3074
3074
  * saved.
3075
3075
  *
3076
- * ####Example:
3076
+ * #### Example:
3077
3077
  *
3078
3078
  * const newProduct = await product.save();
3079
3079
  * newProduct === product; // true
@@ -3601,7 +3601,7 @@ Document.prototype.$toObject = function(options, json) {
3601
3601
  *
3602
3602
  * Buffers are converted to instances of [mongodb.Binary](https://mongodb.github.com/node-mongodb-native/api-bson-generated/binary.html) for proper storage.
3603
3603
  *
3604
- * ####Options:
3604
+ * #### Options:
3605
3605
  *
3606
3606
  * - `getters` apply all getters (path and virtual getters), defaults to false
3607
3607
  * - `aliases` apply all aliases if `virtuals=true`, defaults to true
@@ -3613,7 +3613,7 @@ Document.prototype.$toObject = function(options, json) {
3613
3613
  * - `flattenMaps` convert Maps to POJOs. Useful if you want to JSON.stringify() the result of toObject(), defaults to false
3614
3614
  * - `useProjection` set to `true` to omit fields that are excluded in this document's projection. Unless you specified a projection, this will omit any field that has `select: false` in the schema.
3615
3615
  *
3616
- * ####Getters/Virtuals
3616
+ * #### Getters/Virtuals
3617
3617
  *
3618
3618
  * Example of only applying path getters
3619
3619
  *
@@ -3631,7 +3631,7 @@ Document.prototype.$toObject = function(options, json) {
3631
3631
  *
3632
3632
  * schema.set('toObject', { virtuals: true })
3633
3633
  *
3634
- * ####Transform
3634
+ * #### Transform
3635
3635
  *
3636
3636
  * We may need to perform a transformation of the resulting object based on some criteria, say to remove some sensitive information or return a custom object. In this case we set the optional `transform` function.
3637
3637
  *
@@ -3643,7 +3643,7 @@ Document.prototype.$toObject = function(options, json) {
3643
3643
  * - `ret` The plain object representation which has been converted
3644
3644
  * - `options` The options in use (either schema options or the options passed inline)
3645
3645
  *
3646
- * ####Example
3646
+ * #### Example
3647
3647
  *
3648
3648
  * // specify the transform schema option
3649
3649
  * if (!schema.options.toObject) schema.options.toObject = {};
@@ -4137,7 +4137,7 @@ Document.prototype.equals = function(doc) {
4137
4137
  /**
4138
4138
  * Populates paths on an existing document.
4139
4139
  *
4140
- * ####Example:
4140
+ * #### Example:
4141
4141
  *
4142
4142
  * await doc.populate([
4143
4143
  * 'stories',
@@ -4254,7 +4254,7 @@ Document.prototype.$getPopulatedDocs = function $getPopulatedDocs() {
4254
4254
  /**
4255
4255
  * Gets _id(s) used during population of the given `path`.
4256
4256
  *
4257
- * ####Example:
4257
+ * #### Example:
4258
4258
  *
4259
4259
  * Model.findOne().populate('author').exec(function (err, doc) {
4260
4260
  * console.log(doc.author.name) // Dr.Seuss
@@ -4316,7 +4316,7 @@ Document.prototype.$populated = Document.prototype.populated;
4316
4316
  /**
4317
4317
  * Takes a populated field and returns it to its unpopulated state.
4318
4318
  *
4319
- * ####Example:
4319
+ * #### Example:
4320
4320
  *
4321
4321
  * Model.findOne().populate('author').exec(function (err, doc) {
4322
4322
  * console.log(doc.author.name); // Dr.Seuss
@@ -4,7 +4,7 @@
4
4
  * MongooseError constructor. MongooseError is the base class for all
5
5
  * Mongoose-specific errors.
6
6
  *
7
- * ####Example:
7
+ * #### Example:
8
8
  * const Model = mongoose.model('Test', new Schema({ answer: Number }));
9
9
  * const doc = new Model({ answer: 'not a number' });
10
10
  * const err = doc.validateSync();
@@ -105,7 +105,7 @@ MongooseError.ValidationError = require('./validation');
105
105
  * A `ValidationError` has a hash of `errors` that contain individual
106
106
  * `ValidatorError` instances.
107
107
  *
108
- * ####Example:
108
+ * #### Example:
109
109
  *
110
110
  * const schema = Schema({ name: { type: String, required: true } });
111
111
  * const Model = mongoose.model('Test', schema);
@@ -6,7 +6,7 @@ const utils = require('../../utils');
6
6
  * If populating a path within a document array, make sure each
7
7
  * subdoc within the array knows its subpaths are populated.
8
8
  *
9
- * ####Example:
9
+ * #### Example:
10
10
  * const doc = await Article.findOne().populate('comments.author');
11
11
  * doc.comments[0].populated('author'); // Should be set
12
12
  */
@@ -4,7 +4,7 @@
4
4
  * Creates an object that precomputes whether a given path has child fields in
5
5
  * the projection.
6
6
  *
7
- * ####Example:
7
+ * #### Example:
8
8
  * const res = hasIncludedChildren({ 'a.b.c': 0 });
9
9
  * res.a; // 1
10
10
  * res['a.b']; // 1
package/lib/index.js CHANGED
@@ -47,7 +47,7 @@ const objectIdHexRegexp = /^[0-9A-Fa-f]{24}$/;
47
47
  * The exports object of the `mongoose` module is an instance of this class.
48
48
  * Most apps will only use this one instance.
49
49
  *
50
- * ####Example:
50
+ * #### Example:
51
51
  * const mongoose = require('mongoose');
52
52
  * mongoose instanceof mongoose.Mongoose; // true
53
53
  *
@@ -144,7 +144,7 @@ Mongoose.prototype.driver = driver;
144
144
  /**
145
145
  * Sets mongoose options
146
146
  *
147
- * ####Example:
147
+ * #### Example:
148
148
  *
149
149
  * mongoose.set('test', value) // sets the 'test' option to `value`
150
150
  *
@@ -207,7 +207,7 @@ Mongoose.prototype.set = function(key, value) {
207
207
  /**
208
208
  * Gets mongoose options
209
209
  *
210
- * ####Example:
210
+ * #### Example:
211
211
  *
212
212
  * mongoose.get('test') // returns the 'test' value
213
213
  *
@@ -226,7 +226,7 @@ Mongoose.prototype.get = Mongoose.prototype.set;
226
226
  *
227
227
  * _Options passed take precedence over options included in connection strings._
228
228
  *
229
- * ####Example:
229
+ * #### Example:
230
230
  *
231
231
  * // with mongodb:// URI
232
232
  * db = mongoose.createConnection('mongodb://user:pass@localhost:port/database');
@@ -290,7 +290,7 @@ Mongoose.prototype.createConnection = function(uri, options, callback) {
290
290
  /**
291
291
  * Opens the default mongoose connection.
292
292
  *
293
- * ####Example:
293
+ * #### Example:
294
294
  *
295
295
  * mongoose.connect('mongodb://user:pass@localhost:port/database');
296
296
  *
@@ -424,7 +424,7 @@ Mongoose.prototype.pluralize = function(fn) {
424
424
  * you will get an `OverwriteModelError`. If you call `mongoose.model()` with
425
425
  * the same name and same schema, you'll get the same schema back.
426
426
  *
427
- * ####Example:
427
+ * #### Example:
428
428
  *
429
429
  * const mongoose = require('mongoose');
430
430
  *
@@ -446,7 +446,7 @@ Mongoose.prototype.pluralize = function(fn) {
446
446
  *
447
447
  * _When no `collection` argument is passed, Mongoose uses the model name. If you don't like this behavior, either pass a collection name, use `mongoose.pluralize()`, or set your schemas collection name option._
448
448
  *
449
- * ####Example:
449
+ * #### Example:
450
450
  *
451
451
  * const schema = new Schema({ name: String }, { collection: 'actor' });
452
452
  *
@@ -577,7 +577,7 @@ Mongoose.prototype._model = function(name, schema, collection, options) {
577
577
  *
578
578
  * Equivalent to `mongoose.connection.deleteModel(name)`.
579
579
  *
580
- * ####Example:
580
+ * #### Example:
581
581
  *
582
582
  * mongoose.model('User', new Schema({ name: String }));
583
583
  * console.log(mongoose.model('User')); // Model object
@@ -605,7 +605,7 @@ Mongoose.prototype.deleteModel = function(name) {
605
605
  /**
606
606
  * Returns an array of model names created on this instance of Mongoose.
607
607
  *
608
- * ####Note:
608
+ * #### Note:
609
609
  *
610
610
  * _Does not include names of models created using `connection.model()`._
611
611
  *
@@ -658,7 +658,7 @@ Mongoose.prototype.plugin = function(fn, opts) {
658
658
  /**
659
659
  * The Mongoose module's default connection. Equivalent to `mongoose.connections[0]`, see [`connections`](#mongoose_Mongoose-connections).
660
660
  *
661
- * ####Example:
661
+ * #### Example:
662
662
  *
663
663
  * const mongoose = require('mongoose');
664
664
  * mongoose.connect(...);
@@ -691,7 +691,7 @@ Mongoose.prototype.__defineSetter__('connection', function(v) {
691
691
  * [`createConnection()`](#mongoose_Mongoose-createConnection) adds a connection
692
692
  * to this array.
693
693
  *
694
- * ####Example:
694
+ * #### Example:
695
695
  *
696
696
  * const mongoose = require('mongoose');
697
697
  * mongoose.connections.length; // 1, just the default connection
@@ -767,7 +767,7 @@ Mongoose.prototype.version = pkg.version;
767
767
  *
768
768
  * The exports of the mongoose module is an instance of this class.
769
769
  *
770
- * ####Example:
770
+ * #### Example:
771
771
  *
772
772
  * const mongoose = require('mongoose');
773
773
  * const mongoose2 = new mongoose.Mongoose();
@@ -781,7 +781,7 @@ Mongoose.prototype.Mongoose = Mongoose;
781
781
  /**
782
782
  * The Mongoose [Schema](#schema_Schema) constructor
783
783
  *
784
- * ####Example:
784
+ * #### Example:
785
785
  *
786
786
  * const mongoose = require('mongoose');
787
787
  * const Schema = mongoose.Schema;
@@ -805,7 +805,7 @@ Mongoose.prototype.SchemaType = SchemaType;
805
805
  /**
806
806
  * The various Mongoose SchemaTypes.
807
807
  *
808
- * ####Note:
808
+ * #### Note:
809
809
  *
810
810
  * _Alias of mongoose.Schema.Types for backwards compatibility._
811
811
  *
@@ -828,12 +828,12 @@ Mongoose.prototype.VirtualType = VirtualType;
828
828
  /**
829
829
  * The various Mongoose Types.
830
830
  *
831
- * ####Example:
831
+ * #### Example:
832
832
  *
833
833
  * const mongoose = require('mongoose');
834
834
  * const array = mongoose.Types.Array;
835
835
  *
836
- * ####Types:
836
+ * #### Types:
837
837
  *
838
838
  * - [Array](/docs/schematypes.html#arrays)
839
839
  * - [Buffer](/docs/schematypes.html#buffers)
@@ -926,7 +926,7 @@ Mongoose.prototype.DocumentProvider = require('./document_provider');
926
926
  * Do not use this to create a new ObjectId instance, use `mongoose.Types.ObjectId`
927
927
  * instead.
928
928
  *
929
- * ####Example:
929
+ * #### Example:
930
930
  *
931
931
  * const childSchema = new Schema({ parentId: mongoose.ObjectId });
932
932
  *
@@ -940,7 +940,7 @@ Mongoose.prototype.ObjectId = SchemaTypes.ObjectId;
940
940
  * Returns true if Mongoose can cast the given value to an ObjectId, or
941
941
  * false otherwise.
942
942
  *
943
- * ####Example:
943
+ * #### Example:
944
944
  *
945
945
  * mongoose.isValidObjectId(new mongoose.Types.ObjectId()); // true
946
946
  * mongoose.isValidObjectId('0123456789ab'); // true
@@ -971,7 +971,7 @@ Mongoose.prototype.isValidObjectId = function(v) {
971
971
  * `isObjectIdOrHexString()` returns true only for `ObjectId` instances or 24 character hex
972
972
  * strings, and will return false for numbers, documents, and strings of length 12.
973
973
  *
974
- * ####Example:
974
+ * #### Example:
975
975
  *
976
976
  * mongoose.isObjectIdOrHexString(new mongoose.Types.ObjectId()); // true
977
977
  * mongoose.isObjectIdOrHexString('62261a65d66c6be0a63c051f'); // true
@@ -1012,7 +1012,7 @@ Mongoose.prototype.syncIndexes = function(options) {
1012
1012
  * Do not use this to create a new Decimal128 instance, use `mongoose.Types.Decimal128`
1013
1013
  * instead.
1014
1014
  *
1015
- * ####Example:
1015
+ * #### Example:
1016
1016
  *
1017
1017
  * const vehicleSchema = new Schema({ fuelLevel: mongoose.Decimal128 });
1018
1018
  *
@@ -1027,7 +1027,7 @@ Mongoose.prototype.Decimal128 = SchemaTypes.Decimal128;
1027
1027
  * declaring paths in your schema that Mongoose's change tracking, casting,
1028
1028
  * and validation should ignore.
1029
1029
  *
1030
- * ####Example:
1030
+ * #### Example:
1031
1031
  *
1032
1032
  * const schema = new Schema({ arbitrary: mongoose.Mixed });
1033
1033
  *
@@ -1040,7 +1040,7 @@ Mongoose.prototype.Mixed = SchemaTypes.Mixed;
1040
1040
  /**
1041
1041
  * The Mongoose Date [SchemaType](/docs/schematypes.html).
1042
1042
  *
1043
- * ####Example:
1043
+ * #### Example:
1044
1044
  *
1045
1045
  * const schema = new Schema({ test: Date });
1046
1046
  * schema.path('test') instanceof mongoose.Date; // true
@@ -1055,7 +1055,7 @@ Mongoose.prototype.Date = SchemaTypes.Date;
1055
1055
  * The Mongoose Number [SchemaType](/docs/schematypes.html). Used for
1056
1056
  * declaring paths in your schema that Mongoose should cast to numbers.
1057
1057
  *
1058
- * ####Example:
1058
+ * #### Example:
1059
1059
  *
1060
1060
  * const schema = new Schema({ num: mongoose.Number });
1061
1061
  * // Equivalent to: