mongoose 8.8.1 → 8.8.3
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.
- package/dist/browser.umd.js +1 -1
- package/lib/document.js +37 -43
- package/lib/helpers/indexes/isTimeseriesIndex.js +16 -0
- package/lib/helpers/model/castBulkWrite.js +6 -2
- package/lib/helpers/populate/assignVals.js +1 -5
- package/lib/helpers/populate/getModelsMapForPopulate.js +19 -0
- package/lib/helpers/query/castUpdate.js +22 -0
- package/lib/model.js +10 -3
- package/lib/options/saveOptions.js +2 -0
- package/lib/plugins/saveSubdocs.js +4 -2
- package/lib/query.js +2 -14
- package/lib/schema.js +14 -3
- package/package.json +1 -1
- package/types/cursor.d.ts +5 -3
package/lib/document.js
CHANGED
|
@@ -2711,7 +2711,7 @@ function _getPathsToValidate(doc, pathsToValidate, pathsToSkip, isNestedValidate
|
|
|
2711
2711
|
|
|
2712
2712
|
if (!isNestedValidate) {
|
|
2713
2713
|
// If we're validating a subdocument, all this logic will run anyway on the top-level document, so skip for subdocuments
|
|
2714
|
-
const subdocs = doc.$getAllSubdocs();
|
|
2714
|
+
const subdocs = doc.$getAllSubdocs({ useCache: true });
|
|
2715
2715
|
const modifiedPaths = doc.modifiedPaths();
|
|
2716
2716
|
for (const subdoc of subdocs) {
|
|
2717
2717
|
if (subdoc.$basePath) {
|
|
@@ -3482,7 +3482,7 @@ Document.prototype.$__reset = function reset() {
|
|
|
3482
3482
|
let _this = this;
|
|
3483
3483
|
|
|
3484
3484
|
// Skip for subdocuments
|
|
3485
|
-
const subdocs = !this.$isSubdocument ? this.$getAllSubdocs() : null;
|
|
3485
|
+
const subdocs = !this.$isSubdocument ? this.$getAllSubdocs({ useCache: true }) : null;
|
|
3486
3486
|
if (subdocs && subdocs.length > 0) {
|
|
3487
3487
|
for (const subdoc of subdocs) {
|
|
3488
3488
|
subdoc.$__reset();
|
|
@@ -3672,6 +3672,7 @@ Document.prototype.$__getArrayPathsToValidate = function() {
|
|
|
3672
3672
|
/**
|
|
3673
3673
|
* Get all subdocs (by bfs)
|
|
3674
3674
|
*
|
|
3675
|
+
* @param {Object} [options] options. Currently for internal use.
|
|
3675
3676
|
* @return {Array}
|
|
3676
3677
|
* @api public
|
|
3677
3678
|
* @method $getAllSubdocs
|
|
@@ -3679,57 +3680,50 @@ Document.prototype.$__getArrayPathsToValidate = function() {
|
|
|
3679
3680
|
* @instance
|
|
3680
3681
|
*/
|
|
3681
3682
|
|
|
3682
|
-
Document.prototype.$getAllSubdocs = function() {
|
|
3683
|
+
Document.prototype.$getAllSubdocs = function(options) {
|
|
3684
|
+
if (options?.useCache && this.$__.saveOptions?.__subdocs) {
|
|
3685
|
+
return this.$__.saveOptions.__subdocs;
|
|
3686
|
+
}
|
|
3687
|
+
|
|
3683
3688
|
DocumentArray || (DocumentArray = require('./types/documentArray'));
|
|
3684
3689
|
Embedded = Embedded || require('./types/arraySubdocument');
|
|
3685
3690
|
|
|
3686
|
-
|
|
3687
|
-
|
|
3688
|
-
|
|
3689
|
-
|
|
3690
|
-
|
|
3691
|
-
|
|
3692
|
-
|
|
3693
|
-
val = doc._doc[path];
|
|
3694
|
-
isNested = true;
|
|
3695
|
-
} else {
|
|
3696
|
-
val = doc[path];
|
|
3691
|
+
const subDocs = [];
|
|
3692
|
+
function getSubdocs(doc) {
|
|
3693
|
+
const newSubdocs = [];
|
|
3694
|
+
for (const { path } of doc.$__schema.childSchemas) {
|
|
3695
|
+
const val = doc.$__getValue(path);
|
|
3696
|
+
if (val == null) {
|
|
3697
|
+
continue;
|
|
3697
3698
|
}
|
|
3698
|
-
|
|
3699
|
-
|
|
3700
|
-
|
|
3701
|
-
|
|
3702
|
-
|
|
3703
|
-
|
|
3704
|
-
|
|
3705
|
-
|
|
3706
|
-
seed = Object.keys(val._doc).reduce(function(seed, path) {
|
|
3707
|
-
return docReducer(val, seed, path);
|
|
3708
|
-
}, seed);
|
|
3709
|
-
seed.push(val);
|
|
3710
|
-
} else if (val && utils.isMongooseDocumentArray(val)) {
|
|
3711
|
-
val.forEach(function _docReduce(doc) {
|
|
3712
|
-
if (!doc || !doc._doc) {
|
|
3713
|
-
return;
|
|
3699
|
+
if (val.$__) {
|
|
3700
|
+
newSubdocs.push(val);
|
|
3701
|
+
}
|
|
3702
|
+
if (Array.isArray(val)) {
|
|
3703
|
+
for (const el of val) {
|
|
3704
|
+
if (el != null && el.$__) {
|
|
3705
|
+
newSubdocs.push(el);
|
|
3706
|
+
}
|
|
3714
3707
|
}
|
|
3715
|
-
|
|
3716
|
-
|
|
3717
|
-
|
|
3718
|
-
|
|
3719
|
-
|
|
3708
|
+
}
|
|
3709
|
+
if (val instanceof Map) {
|
|
3710
|
+
for (const el of val.values()) {
|
|
3711
|
+
if (el != null && el.$__) {
|
|
3712
|
+
newSubdocs.push(el);
|
|
3713
|
+
}
|
|
3720
3714
|
}
|
|
3721
|
-
});
|
|
3722
|
-
} else if (isNested && val != null) {
|
|
3723
|
-
for (const path of Object.keys(val)) {
|
|
3724
|
-
docReducer(val, seed, path);
|
|
3725
3715
|
}
|
|
3726
3716
|
}
|
|
3727
|
-
|
|
3717
|
+
for (const subdoc of newSubdocs) {
|
|
3718
|
+
getSubdocs(subdoc);
|
|
3719
|
+
}
|
|
3720
|
+
subDocs.push(...newSubdocs);
|
|
3728
3721
|
}
|
|
3729
3722
|
|
|
3730
|
-
|
|
3731
|
-
|
|
3732
|
-
|
|
3723
|
+
getSubdocs(this);
|
|
3724
|
+
|
|
3725
|
+
if (this.$__.saveOptions) {
|
|
3726
|
+
this.$__.saveOptions.__subdocs = subDocs;
|
|
3733
3727
|
}
|
|
3734
3728
|
|
|
3735
3729
|
return subDocs;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Returns `true` if the given index matches the schema's `timestamps` options
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
module.exports = function isTimeseriesIndex(dbIndex, schemaOptions) {
|
|
8
|
+
if (schemaOptions.timeseries == null) {
|
|
9
|
+
return false;
|
|
10
|
+
}
|
|
11
|
+
const { timeField, metaField } = schemaOptions.timeseries;
|
|
12
|
+
if (typeof timeField !== 'string' || typeof metaField !== 'string') {
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
15
|
+
return Object.keys(dbIndex.key).length === 2 && dbIndex.key[timeField] === 1 && dbIndex.key[metaField] === 1;
|
|
16
|
+
};
|
|
@@ -103,7 +103,9 @@ module.exports = function castBulkWrite(originalModel, op, options) {
|
|
|
103
103
|
});
|
|
104
104
|
op['updateOne']['update'] = castUpdate(model.schema, update, {
|
|
105
105
|
strict: strict,
|
|
106
|
-
upsert: op['updateOne'].upsert
|
|
106
|
+
upsert: op['updateOne'].upsert,
|
|
107
|
+
arrayFilters: op['updateOne'].arrayFilters,
|
|
108
|
+
overwriteDiscriminatorKey: op['updateOne'].overwriteDiscriminatorKey
|
|
107
109
|
}, model, op['updateOne']['filter']);
|
|
108
110
|
} catch (error) {
|
|
109
111
|
return callback(error, null);
|
|
@@ -162,7 +164,9 @@ module.exports = function castBulkWrite(originalModel, op, options) {
|
|
|
162
164
|
|
|
163
165
|
op['updateMany']['update'] = castUpdate(model.schema, op['updateMany']['update'], {
|
|
164
166
|
strict: strict,
|
|
165
|
-
upsert: op['updateMany'].upsert
|
|
167
|
+
upsert: op['updateMany'].upsert,
|
|
168
|
+
arrayFilters: op['updateMany'].arrayFilters,
|
|
169
|
+
overwriteDiscriminatorKey: op['updateMany'].overwriteDiscriminatorKey
|
|
166
170
|
}, model, op['updateMany']['filter']);
|
|
167
171
|
} catch (error) {
|
|
168
172
|
return callback(error, null);
|
|
@@ -249,7 +249,7 @@ function numDocs(v) {
|
|
|
249
249
|
|
|
250
250
|
function valueFilter(val, assignmentOpts, populateOptions, allIds) {
|
|
251
251
|
const userSpecifiedTransform = typeof populateOptions.transform === 'function';
|
|
252
|
-
const transform = userSpecifiedTransform ? populateOptions.transform :
|
|
252
|
+
const transform = userSpecifiedTransform ? populateOptions.transform : v => v;
|
|
253
253
|
if (Array.isArray(val)) {
|
|
254
254
|
// find logic
|
|
255
255
|
const ret = [];
|
|
@@ -341,7 +341,3 @@ function isPopulatedObject(obj) {
|
|
|
341
341
|
obj.$__ != null ||
|
|
342
342
|
leanPopulateMap.has(obj);
|
|
343
343
|
}
|
|
344
|
-
|
|
345
|
-
function noop(v) {
|
|
346
|
-
return v;
|
|
347
|
-
}
|
|
@@ -184,6 +184,15 @@ module.exports = function getModelsMapForPopulate(model, docs, options) {
|
|
|
184
184
|
if (hasMatchFunction) {
|
|
185
185
|
match = match.call(doc, doc);
|
|
186
186
|
}
|
|
187
|
+
if (Array.isArray(match)) {
|
|
188
|
+
for (const item of match) {
|
|
189
|
+
if (item != null && item.$where) {
|
|
190
|
+
throw new MongooseError('Cannot use $where filter with populate() match');
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
} else if (match != null && match.$where != null) {
|
|
194
|
+
throw new MongooseError('Cannot use $where filter with populate() match');
|
|
195
|
+
}
|
|
187
196
|
data.match = match;
|
|
188
197
|
data.hasMatchFunction = hasMatchFunction;
|
|
189
198
|
data.isRefPath = isRefPath;
|
|
@@ -447,6 +456,16 @@ function _virtualPopulate(model, docs, options, _virtualRes) {
|
|
|
447
456
|
data.match = match;
|
|
448
457
|
data.hasMatchFunction = hasMatchFunction;
|
|
449
458
|
|
|
459
|
+
if (Array.isArray(match)) {
|
|
460
|
+
for (const item of match) {
|
|
461
|
+
if (item != null && item.$where) {
|
|
462
|
+
throw new MongooseError('Cannot use $where filter with populate() match');
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
} else if (match != null && match.$where != null) {
|
|
466
|
+
throw new MongooseError('Cannot use $where filter with populate() match');
|
|
467
|
+
}
|
|
468
|
+
|
|
450
469
|
// Get local fields
|
|
451
470
|
const ret = _getLocalFieldValues(doc, localField, model, options, virtual);
|
|
452
471
|
|
|
@@ -8,6 +8,7 @@ const ValidationError = require('../../error/validation');
|
|
|
8
8
|
const castNumber = require('../../cast/number');
|
|
9
9
|
const cast = require('../../cast');
|
|
10
10
|
const getConstructorName = require('../getConstructorName');
|
|
11
|
+
const getDiscriminatorByValue = require('../discriminator/getDiscriminatorByValue');
|
|
11
12
|
const getEmbeddedDiscriminatorPath = require('./getEmbeddedDiscriminatorPath');
|
|
12
13
|
const handleImmutable = require('./handleImmutable');
|
|
13
14
|
const moveImmutableProperties = require('../update/moveImmutableProperties');
|
|
@@ -62,6 +63,27 @@ module.exports = function castUpdate(schema, obj, options, context, filter) {
|
|
|
62
63
|
return obj;
|
|
63
64
|
}
|
|
64
65
|
|
|
66
|
+
if (schema != null &&
|
|
67
|
+
filter != null &&
|
|
68
|
+
utils.hasUserDefinedProperty(filter, schema.options.discriminatorKey) &&
|
|
69
|
+
typeof filter[schema.options.discriminatorKey] !== 'object' &&
|
|
70
|
+
schema.discriminators != null) {
|
|
71
|
+
const discriminatorValue = filter[schema.options.discriminatorKey];
|
|
72
|
+
const byValue = getDiscriminatorByValue(context.model.discriminators, discriminatorValue);
|
|
73
|
+
schema = schema.discriminators[discriminatorValue] ||
|
|
74
|
+
(byValue && byValue.schema) ||
|
|
75
|
+
schema;
|
|
76
|
+
} else if (schema != null &&
|
|
77
|
+
options.overwriteDiscriminatorKey &&
|
|
78
|
+
utils.hasUserDefinedProperty(obj, schema.options.discriminatorKey) &&
|
|
79
|
+
schema.discriminators != null) {
|
|
80
|
+
const discriminatorValue = obj[schema.options.discriminatorKey];
|
|
81
|
+
const byValue = getDiscriminatorByValue(context.model.discriminators, discriminatorValue);
|
|
82
|
+
schema = schema.discriminators[discriminatorValue] ||
|
|
83
|
+
(byValue && byValue.schema) ||
|
|
84
|
+
schema;
|
|
85
|
+
}
|
|
86
|
+
|
|
65
87
|
if (options.upsert) {
|
|
66
88
|
moveImmutableProperties(schema, obj, context);
|
|
67
89
|
}
|
package/lib/model.js
CHANGED
|
@@ -51,6 +51,7 @@ const immediate = require('./helpers/immediate');
|
|
|
51
51
|
const internalToObjectOptions = require('./options').internalToObjectOptions;
|
|
52
52
|
const isDefaultIdIndex = require('./helpers/indexes/isDefaultIdIndex');
|
|
53
53
|
const isIndexEqual = require('./helpers/indexes/isIndexEqual');
|
|
54
|
+
const isTimeseriesIndex = require('./helpers/indexes/isTimeseriesIndex');
|
|
54
55
|
const {
|
|
55
56
|
getRelatedDBIndexes,
|
|
56
57
|
getRelatedSchemaIndexes
|
|
@@ -1418,6 +1419,10 @@ function getIndexesToDrop(schema, schemaIndexes, dbIndexes) {
|
|
|
1418
1419
|
if (isDefaultIdIndex(dbIndex)) {
|
|
1419
1420
|
continue;
|
|
1420
1421
|
}
|
|
1422
|
+
// Timeseries collections have a default index on { timeField: 1, metaField: 1 }.
|
|
1423
|
+
if (isTimeseriesIndex(dbIndex, schema.options)) {
|
|
1424
|
+
continue;
|
|
1425
|
+
}
|
|
1421
1426
|
|
|
1422
1427
|
for (const [schemaIndexKeysObject, schemaIndexOptions] of schemaIndexes) {
|
|
1423
1428
|
const options = decorateDiscriminatorIndexOptions(schema, clone(schemaIndexOptions));
|
|
@@ -1429,9 +1434,11 @@ function getIndexesToDrop(schema, schemaIndexes, dbIndexes) {
|
|
|
1429
1434
|
}
|
|
1430
1435
|
}
|
|
1431
1436
|
|
|
1432
|
-
if (
|
|
1433
|
-
|
|
1437
|
+
if (found) {
|
|
1438
|
+
continue;
|
|
1434
1439
|
}
|
|
1440
|
+
|
|
1441
|
+
toDrop.push(dbIndex.name);
|
|
1435
1442
|
}
|
|
1436
1443
|
|
|
1437
1444
|
return toDrop;
|
|
@@ -3139,7 +3146,7 @@ function _setIsNew(doc, val) {
|
|
|
3139
3146
|
doc.$emit('isNew', val);
|
|
3140
3147
|
doc.constructor.emit('isNew', val);
|
|
3141
3148
|
|
|
3142
|
-
const subdocs = doc.$getAllSubdocs();
|
|
3149
|
+
const subdocs = doc.$getAllSubdocs({ useCache: true });
|
|
3143
3150
|
for (const subdoc of subdocs) {
|
|
3144
3151
|
subdoc.$isNew = val;
|
|
3145
3152
|
subdoc.$emit('isNew', val);
|
|
@@ -15,7 +15,7 @@ module.exports = function saveSubdocs(schema) {
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
const _this = this;
|
|
18
|
-
const subdocs = this.$getAllSubdocs();
|
|
18
|
+
const subdocs = this.$getAllSubdocs({ useCache: true });
|
|
19
19
|
|
|
20
20
|
if (!subdocs.length) {
|
|
21
21
|
next();
|
|
@@ -27,6 +27,8 @@ module.exports = function saveSubdocs(schema) {
|
|
|
27
27
|
cb(err);
|
|
28
28
|
});
|
|
29
29
|
}, function(error) {
|
|
30
|
+
// Bust subdocs cache because subdoc pre hooks can add new subdocuments
|
|
31
|
+
_this.$__.saveOptions.__subdocs = null;
|
|
30
32
|
if (error) {
|
|
31
33
|
return _this.$__schema.s.hooks.execPost('save:error', _this, [_this], { error: error }, function(error) {
|
|
32
34
|
next(error);
|
|
@@ -64,7 +66,7 @@ module.exports = function saveSubdocs(schema) {
|
|
|
64
66
|
}
|
|
65
67
|
|
|
66
68
|
const _this = this;
|
|
67
|
-
const subdocs = this.$getAllSubdocs();
|
|
69
|
+
const subdocs = this.$getAllSubdocs({ useCache: true });
|
|
68
70
|
|
|
69
71
|
if (!subdocs.length) {
|
|
70
72
|
return;
|
package/lib/query.js
CHANGED
|
@@ -4433,10 +4433,10 @@ Query.prototype.exec = async function exec(op) {
|
|
|
4433
4433
|
str = str.slice(0, 60) + '...';
|
|
4434
4434
|
}
|
|
4435
4435
|
const err = new MongooseError('Query was already executed: ' + str);
|
|
4436
|
-
err.originalStack = this._executionStack
|
|
4436
|
+
err.originalStack = this._executionStack;
|
|
4437
4437
|
throw err;
|
|
4438
4438
|
} else {
|
|
4439
|
-
this._executionStack = new Error();
|
|
4439
|
+
this._executionStack = new Error().stack;
|
|
4440
4440
|
}
|
|
4441
4441
|
|
|
4442
4442
|
let skipWrappedFunction = null;
|
|
@@ -4700,18 +4700,6 @@ Query.prototype._castUpdate = function _castUpdate(obj) {
|
|
|
4700
4700
|
upsert = this.options.upsert;
|
|
4701
4701
|
}
|
|
4702
4702
|
|
|
4703
|
-
const filter = this._conditions;
|
|
4704
|
-
if (schema != null &&
|
|
4705
|
-
utils.hasUserDefinedProperty(filter, schema.options.discriminatorKey) &&
|
|
4706
|
-
typeof filter[schema.options.discriminatorKey] !== 'object' &&
|
|
4707
|
-
schema.discriminators != null) {
|
|
4708
|
-
const discriminatorValue = filter[schema.options.discriminatorKey];
|
|
4709
|
-
const byValue = getDiscriminatorByValue(this.model.discriminators, discriminatorValue);
|
|
4710
|
-
schema = schema.discriminators[discriminatorValue] ||
|
|
4711
|
-
(byValue && byValue.schema) ||
|
|
4712
|
-
schema;
|
|
4713
|
-
}
|
|
4714
|
-
|
|
4715
4703
|
return castUpdate(schema, obj, {
|
|
4716
4704
|
strict: this._mongooseOptions.strict,
|
|
4717
4705
|
upsert: upsert,
|
package/lib/schema.js
CHANGED
|
@@ -1126,6 +1126,13 @@ Schema.prototype.path = function(path, obj) {
|
|
|
1126
1126
|
|
|
1127
1127
|
this.paths[mapPath] = schemaType.$__schemaType;
|
|
1128
1128
|
this.mapPaths.push(this.paths[mapPath]);
|
|
1129
|
+
if (schemaType.$__schemaType.$isSingleNested) {
|
|
1130
|
+
this.childSchemas.push({
|
|
1131
|
+
schema: schemaType.$__schemaType.schema,
|
|
1132
|
+
model: schemaType.$__schemaType.caster,
|
|
1133
|
+
path: path
|
|
1134
|
+
});
|
|
1135
|
+
}
|
|
1129
1136
|
}
|
|
1130
1137
|
|
|
1131
1138
|
if (schemaType.$isSingleNested) {
|
|
@@ -1154,7 +1161,8 @@ Schema.prototype.path = function(path, obj) {
|
|
|
1154
1161
|
schemaType.caster.base = this.base;
|
|
1155
1162
|
this.childSchemas.push({
|
|
1156
1163
|
schema: schemaType.schema,
|
|
1157
|
-
model: schemaType.caster
|
|
1164
|
+
model: schemaType.caster,
|
|
1165
|
+
path: path
|
|
1158
1166
|
});
|
|
1159
1167
|
} else if (schemaType.$isMongooseDocumentArray) {
|
|
1160
1168
|
Object.defineProperty(schemaType.schema, 'base', {
|
|
@@ -1167,7 +1175,8 @@ Schema.prototype.path = function(path, obj) {
|
|
|
1167
1175
|
schemaType.casterConstructor.base = this.base;
|
|
1168
1176
|
this.childSchemas.push({
|
|
1169
1177
|
schema: schemaType.schema,
|
|
1170
|
-
model: schemaType.casterConstructor
|
|
1178
|
+
model: schemaType.casterConstructor,
|
|
1179
|
+
path: path
|
|
1171
1180
|
});
|
|
1172
1181
|
}
|
|
1173
1182
|
|
|
@@ -1235,7 +1244,9 @@ function gatherChildSchemas(schema) {
|
|
|
1235
1244
|
for (const path of Object.keys(schema.paths)) {
|
|
1236
1245
|
const schematype = schema.paths[path];
|
|
1237
1246
|
if (schematype.$isMongooseDocumentArray || schematype.$isSingleNested) {
|
|
1238
|
-
childSchemas.push({ schema: schematype.schema, model: schematype.caster });
|
|
1247
|
+
childSchemas.push({ schema: schematype.schema, model: schematype.caster, path: path });
|
|
1248
|
+
} else if (schematype.$isSchemaMap && schematype.$__schemaType.$isSingleNested) {
|
|
1249
|
+
childSchemas.push({ schema: schematype.$__schemaType.schema, model: schematype.$__schemaType.caster, path: path });
|
|
1239
1250
|
}
|
|
1240
1251
|
}
|
|
1241
1252
|
|
package/package.json
CHANGED
package/types/cursor.d.ts
CHANGED
|
@@ -11,8 +11,10 @@ declare module 'mongoose' {
|
|
|
11
11
|
signal?: AbortSignal;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
class Cursor<DocType = any, Options = never> extends stream.Readable {
|
|
15
|
-
[Symbol.asyncIterator]():
|
|
14
|
+
class Cursor<DocType = any, Options = never, NextResultType = DocType | null> extends stream.Readable {
|
|
15
|
+
[Symbol.asyncIterator](): Cursor<IteratorResult<DocType>, Options, IteratorResult<DocType>>;
|
|
16
|
+
|
|
17
|
+
[Symbol.asyncDispose](): Promise<void>;
|
|
16
18
|
|
|
17
19
|
/**
|
|
18
20
|
* Adds a [cursor flag](https://mongodb.github.io/node-mongodb-native/4.9/classes/FindCursor.html#addCursorFlag).
|
|
@@ -58,7 +60,7 @@ declare module 'mongoose' {
|
|
|
58
60
|
* Get the next document from this cursor. Will return `null` when there are
|
|
59
61
|
* no documents left.
|
|
60
62
|
*/
|
|
61
|
-
next(): Promise<
|
|
63
|
+
next(): Promise<NextResultType>;
|
|
62
64
|
|
|
63
65
|
options: Options;
|
|
64
66
|
}
|