mongoose 6.5.2 → 6.5.5
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/.mocharc.yml +2 -0
- package/dist/browser.umd.js +1148 -68091
- package/lib/aggregate.js +7 -7
- package/lib/browserDocument.js +1 -1
- package/lib/cast/boolean.js +1 -1
- package/lib/cast/number.js +1 -1
- package/lib/cast/string.js +1 -1
- package/lib/cast.js +3 -0
- package/lib/connection.js +19 -11
- package/lib/cursor/AggregationCursor.js +16 -5
- package/lib/cursor/QueryCursor.js +16 -5
- package/lib/document.js +31 -18
- package/lib/drivers/browser/objectid.js +2 -1
- package/lib/drivers/node-mongodb-native/ReadPreference.js +1 -1
- package/lib/drivers/node-mongodb-native/collection.js +6 -2
- package/lib/error/browserMissingSchema.js +1 -1
- package/lib/error/cast.js +2 -1
- package/lib/error/divergentArray.js +2 -1
- package/lib/error/missingSchema.js +2 -1
- package/lib/error/notFound.js +2 -1
- package/lib/error/overwriteModel.js +2 -1
- package/lib/error/strictPopulate.js +29 -0
- package/lib/error/validation.js +9 -7
- package/lib/error/validator.js +8 -4
- package/lib/helpers/clone.js +1 -1
- package/lib/helpers/discriminator/getConstructor.js +2 -1
- package/lib/helpers/discriminator/getDiscriminatorByValue.js +7 -6
- package/lib/helpers/discriminator/getSchemaDiscriminatorByValue.js +7 -6
- package/lib/helpers/document/compile.js +14 -2
- package/lib/helpers/document/getEmbeddedDiscriminatorPath.js +5 -1
- package/lib/helpers/get.js +2 -1
- package/lib/helpers/getConstructorName.js +2 -1
- package/lib/helpers/indexes/isIndexEqual.js +6 -6
- package/lib/helpers/isBsonType.js +2 -1
- package/lib/helpers/isMongooseObject.js +2 -2
- package/lib/helpers/isObject.js +1 -1
- package/lib/helpers/isSimpleValidator.js +1 -1
- package/lib/helpers/model/applyHooks.js +11 -0
- package/lib/helpers/model/applyMethods.js +11 -1
- package/lib/helpers/model/applyStatics.js +2 -1
- package/lib/helpers/model/castBulkWrite.js +7 -2
- package/lib/helpers/model/discriminator.js +3 -1
- package/lib/helpers/path/flattenObjectWithDottedPaths.js +3 -2
- package/lib/helpers/pluralize.js +1 -1
- package/lib/helpers/populate/assignRawDocsToIdStructure.js +5 -3
- package/lib/helpers/populate/assignVals.js +14 -3
- package/lib/helpers/populate/createPopulateQueryFilter.js +8 -2
- package/lib/helpers/populate/getModelsMapForPopulate.js +5 -4
- package/lib/helpers/populate/getSchemaTypes.js +3 -1
- package/lib/helpers/populate/markArraySubdocsPopulated.js +5 -1
- package/lib/helpers/projection/hasIncludedChildren.js +4 -1
- package/lib/helpers/projection/isPathExcluded.js +3 -2
- package/lib/helpers/projection/isSubpath.js +2 -1
- package/lib/helpers/query/applyQueryMiddleware.js +3 -2
- package/lib/helpers/query/castUpdate.js +14 -8
- package/lib/helpers/query/completeMany.js +3 -2
- package/lib/helpers/query/getEmbeddedDiscriminatorPath.js +7 -1
- package/lib/helpers/query/wrapThunk.js +3 -1
- package/lib/helpers/schema/getIndexes.js +7 -2
- package/lib/helpers/schema/getPath.js +4 -3
- package/lib/helpers/schema/idGetter.js +2 -1
- package/lib/helpers/setDefaultsOnInsert.js +15 -0
- package/lib/index.js +20 -12
- package/lib/model.js +219 -145
- package/lib/query.js +160 -65
- package/lib/queryhelpers.js +4 -4
- package/lib/schema/SubdocumentPath.js +1 -1
- package/lib/schema/array.js +2 -2
- package/lib/schema/date.js +2 -1
- package/lib/schema/documentarray.js +4 -3
- package/lib/schema/operators/helpers.js +2 -2
- package/lib/schema/operators/text.js +1 -1
- package/lib/schema/string.js +1 -1
- package/lib/schema.js +14 -5
- package/lib/schematype.js +17 -4
- package/lib/statemachine.js +13 -12
- package/lib/types/ArraySubdocument.js +13 -3
- package/lib/types/DocumentArray/methods/index.js +9 -5
- package/lib/types/array/methods/index.js +5 -4
- package/lib/types/map.js +3 -1
- package/lib/types/objectid.js +2 -2
- package/lib/types/subdocument.js +30 -8
- package/lib/utils.js +58 -31
- package/package.json +11 -11
- package/scripts/create-tarball.js +7 -0
- package/types/aggregate.d.ts +3 -3
- package/types/connection.d.ts +4 -4
- package/types/cursor.d.ts +1 -1
- package/types/document.d.ts +2 -2
- package/types/index.d.ts +13 -27
- package/types/indexes.d.ts +2 -2
- package/types/middlewares.d.ts +1 -1
- package/types/models.d.ts +14 -11
- package/types/pipelinestage.d.ts +1 -1
- package/types/query.d.ts +33 -16
package/lib/query.js
CHANGED
|
@@ -1191,7 +1191,7 @@ Query.prototype.select = function select() {
|
|
|
1191
1191
|
* // read from secondaries with matching tags
|
|
1192
1192
|
* new Query().read('s', [{ dc:'sf', s: 1 },{ dc:'ma', s: 2 }])
|
|
1193
1193
|
*
|
|
1194
|
-
* Read more about how to use read preferences [here](https://docs.mongodb.org/manual/applications/replication/#read-preference)
|
|
1194
|
+
* Read more about how to use read preferences [here](https://docs.mongodb.org/manual/applications/replication/#read-preference).
|
|
1195
1195
|
*
|
|
1196
1196
|
* @method read
|
|
1197
1197
|
* @memberOf Query
|
|
@@ -1199,7 +1199,6 @@ Query.prototype.select = function select() {
|
|
|
1199
1199
|
* @param {String} pref one of the listed preference options or aliases
|
|
1200
1200
|
* @param {Array} [tags] optional tags for this query
|
|
1201
1201
|
* @see mongodb https://docs.mongodb.org/manual/applications/replication/#read-preference
|
|
1202
|
-
* @see driver https://mongodb.github.com/node-mongodb-native/driver-articles/anintroductionto1_1and2_2.html#read-preferences
|
|
1203
1202
|
* @return {Query} this
|
|
1204
1203
|
* @api public
|
|
1205
1204
|
*/
|
|
@@ -1211,8 +1210,13 @@ Query.prototype.read = function read(pref, tags) {
|
|
|
1211
1210
|
return this;
|
|
1212
1211
|
};
|
|
1213
1212
|
|
|
1214
|
-
|
|
1215
|
-
*
|
|
1213
|
+
/**
|
|
1214
|
+
* Overwrite default `.toString` to make logging more useful
|
|
1215
|
+
*
|
|
1216
|
+
* @memberOf Query
|
|
1217
|
+
* @instance
|
|
1218
|
+
* @method toString
|
|
1219
|
+
* @api private
|
|
1216
1220
|
*/
|
|
1217
1221
|
|
|
1218
1222
|
Query.prototype.toString = function toString() {
|
|
@@ -1306,7 +1310,7 @@ Query.prototype.session = function session(v) {
|
|
|
1306
1310
|
* @memberOf Query
|
|
1307
1311
|
* @instance
|
|
1308
1312
|
* @param {Object} writeConcern the write concern value to set
|
|
1309
|
-
* @see
|
|
1313
|
+
* @see WriteConcernSettings https://mongodb.github.io/node-mongodb-native/4.9/interfaces/WriteConcernSettings.html
|
|
1310
1314
|
* @return {Query} this
|
|
1311
1315
|
* @api public
|
|
1312
1316
|
*/
|
|
@@ -2127,8 +2131,12 @@ Query.prototype.error = function error(err) {
|
|
|
2127
2131
|
return this;
|
|
2128
2132
|
};
|
|
2129
2133
|
|
|
2130
|
-
|
|
2134
|
+
/**
|
|
2131
2135
|
* ignore
|
|
2136
|
+
* @method _unsetCastError
|
|
2137
|
+
* @instance
|
|
2138
|
+
* @memberOf Query
|
|
2139
|
+
* @api private
|
|
2132
2140
|
*/
|
|
2133
2141
|
|
|
2134
2142
|
Query.prototype._unsetCastError = function _unsetCastError() {
|
|
@@ -2164,8 +2172,12 @@ Query.prototype.mongooseOptions = function(v) {
|
|
|
2164
2172
|
return this._mongooseOptions;
|
|
2165
2173
|
};
|
|
2166
2174
|
|
|
2167
|
-
|
|
2175
|
+
/**
|
|
2168
2176
|
* ignore
|
|
2177
|
+
* @method _castConditions
|
|
2178
|
+
* @memberOf Query
|
|
2179
|
+
* @api private
|
|
2180
|
+
* @instance
|
|
2169
2181
|
*/
|
|
2170
2182
|
|
|
2171
2183
|
Query.prototype._castConditions = function() {
|
|
@@ -2617,7 +2629,7 @@ Query.prototype._count = wrapThunk(function(callback) {
|
|
|
2617
2629
|
* Thunk around countDocuments()
|
|
2618
2630
|
*
|
|
2619
2631
|
* @param {Function} [callback]
|
|
2620
|
-
* @see countDocuments https://mongodb.github.io/node-mongodb-native/
|
|
2632
|
+
* @see countDocuments https://mongodb.github.io/node-mongodb-native/4.9/classes/Collection.html#countDocuments
|
|
2621
2633
|
* @api private
|
|
2622
2634
|
*/
|
|
2623
2635
|
|
|
@@ -2645,7 +2657,7 @@ Query.prototype._countDocuments = wrapThunk(function(callback) {
|
|
|
2645
2657
|
* Thunk around estimatedDocumentCount()
|
|
2646
2658
|
*
|
|
2647
2659
|
* @param {Function} [callback]
|
|
2648
|
-
* @see estimatedDocumentCount https://mongodb.github.io/node-mongodb-native/
|
|
2660
|
+
* @see estimatedDocumentCount https://mongodb.github.io/node-mongodb-native/4.9/classes/Collection.html#estimatedDocumentCount
|
|
2649
2661
|
* @api private
|
|
2650
2662
|
*/
|
|
2651
2663
|
|
|
@@ -2733,10 +2745,10 @@ Query.prototype.count = function(filter, callback) {
|
|
|
2733
2745
|
*
|
|
2734
2746
|
* await Model.find().estimatedDocumentCount();
|
|
2735
2747
|
*
|
|
2736
|
-
* @param {Object} [options] passed transparently to the [MongoDB driver](https://mongodb.github.io/node-mongodb-native/
|
|
2748
|
+
* @param {Object} [options] passed transparently to the [MongoDB driver](https://mongodb.github.io/node-mongodb-native/4.9/interfaces/EstimatedDocumentCountOptions.html)
|
|
2737
2749
|
* @param {Function} [callback] optional params are (error, count)
|
|
2738
2750
|
* @return {Query} this
|
|
2739
|
-
* @see estimatedDocumentCount https://mongodb.github.io/node-mongodb-native/
|
|
2751
|
+
* @see estimatedDocumentCount https://mongodb.github.io/node-mongodb-native/4.9/classes/Collection.html#estimatedDocumentCount
|
|
2740
2752
|
* @api public
|
|
2741
2753
|
*/
|
|
2742
2754
|
|
|
@@ -2766,7 +2778,7 @@ Query.prototype.estimatedDocumentCount = function(options, callback) {
|
|
|
2766
2778
|
* except it always does a full collection scan when passed an empty filter `{}`.
|
|
2767
2779
|
*
|
|
2768
2780
|
* There are also minor differences in how `countDocuments()` handles
|
|
2769
|
-
* [`$where` and a couple geospatial operators](https://mongodb.github.io/node-mongodb-native/
|
|
2781
|
+
* [`$where` and a couple geospatial operators](https://mongodb.github.io/node-mongodb-native/4.9/classes/Collection.html#countDocuments).
|
|
2770
2782
|
* versus `count()`.
|
|
2771
2783
|
*
|
|
2772
2784
|
* Passing a `callback` executes the query.
|
|
@@ -2789,7 +2801,7 @@ Query.prototype.estimatedDocumentCount = function(options, callback) {
|
|
|
2789
2801
|
* });
|
|
2790
2802
|
*
|
|
2791
2803
|
* The `countDocuments()` function is similar to `count()`, but there are a
|
|
2792
|
-
* [few operators that `countDocuments()` does not support](https://mongodb.github.io/node-mongodb-native/
|
|
2804
|
+
* [few operators that `countDocuments()` does not support](https://mongodb.github.io/node-mongodb-native/4.9/classes/Collection.html#countDocuments).
|
|
2793
2805
|
* Below are the operators that `count()` supports but `countDocuments()` does not,
|
|
2794
2806
|
* and the suggested replacement:
|
|
2795
2807
|
*
|
|
@@ -2801,7 +2813,7 @@ Query.prototype.estimatedDocumentCount = function(options, callback) {
|
|
|
2801
2813
|
* @param {Object} [options]
|
|
2802
2814
|
* @param {Function} [callback] optional params are (error, count)
|
|
2803
2815
|
* @return {Query} this
|
|
2804
|
-
* @see countDocuments https://mongodb.github.io/node-mongodb-native/
|
|
2816
|
+
* @see countDocuments https://mongodb.github.io/node-mongodb-native/4.9/classes/Collection.html#countDocuments
|
|
2805
2817
|
* @api public
|
|
2806
2818
|
*/
|
|
2807
2819
|
|
|
@@ -2968,7 +2980,7 @@ Query.prototype.sort = function(arg) {
|
|
|
2968
2980
|
*
|
|
2969
2981
|
* Character.remove({ name: /Stark/ }, callback);
|
|
2970
2982
|
*
|
|
2971
|
-
* This function calls the MongoDB driver's [`Collection#remove()` function](https://mongodb.github.io/node-mongodb-native/
|
|
2983
|
+
* This function calls the MongoDB driver's [`Collection#remove()` function](https://mongodb.github.io/node-mongodb-native/4.9/classes/Collection.html#remove).
|
|
2972
2984
|
* The returned [promise](https://mongoosejs.com/docs/queries.html) resolves to an
|
|
2973
2985
|
* object that contains 3 properties:
|
|
2974
2986
|
*
|
|
@@ -3002,8 +3014,8 @@ Query.prototype.sort = function(arg) {
|
|
|
3002
3014
|
* @param {Function} [callback] optional params are (error, mongooseDeleteResult)
|
|
3003
3015
|
* @return {Query} this
|
|
3004
3016
|
* @deprecated
|
|
3005
|
-
* @see
|
|
3006
|
-
* @see
|
|
3017
|
+
* @see DeleteResult https://mongodb.github.io/node-mongodb-native/4.9/interfaces/DeleteResult.html
|
|
3018
|
+
* @see remove https://mongodb.github.io/node-mongodb-native/4.9/classes/Collection.html#remove
|
|
3007
3019
|
* @api public
|
|
3008
3020
|
*/
|
|
3009
3021
|
|
|
@@ -3032,8 +3044,13 @@ Query.prototype.remove = function(filter, callback) {
|
|
|
3032
3044
|
return this;
|
|
3033
3045
|
};
|
|
3034
3046
|
|
|
3035
|
-
|
|
3047
|
+
/**
|
|
3036
3048
|
* ignore
|
|
3049
|
+
* @param {Function} callback
|
|
3050
|
+
* @method _remove
|
|
3051
|
+
* @memberOf Query
|
|
3052
|
+
* @instance
|
|
3053
|
+
* @api private
|
|
3037
3054
|
*/
|
|
3038
3055
|
|
|
3039
3056
|
Query.prototype._remove = wrapThunk(function(callback) {
|
|
@@ -3063,7 +3080,7 @@ Query.prototype._remove = wrapThunk(function(callback) {
|
|
|
3063
3080
|
* // Using callbacks:
|
|
3064
3081
|
* Character.deleteOne({ name: 'Eddard Stark' }, callback);
|
|
3065
3082
|
*
|
|
3066
|
-
* This function calls the MongoDB driver's [`Collection#deleteOne()` function](https://mongodb.github.io/node-mongodb-native/
|
|
3083
|
+
* This function calls the MongoDB driver's [`Collection#deleteOne()` function](https://mongodb.github.io/node-mongodb-native/4.9/classes/Collection.html#deleteOne).
|
|
3067
3084
|
* The returned [promise](https://mongoosejs.com/docs/queries.html) resolves to an
|
|
3068
3085
|
* object that contains 3 properties:
|
|
3069
3086
|
*
|
|
@@ -3081,8 +3098,8 @@ Query.prototype._remove = wrapThunk(function(callback) {
|
|
|
3081
3098
|
* @param {Object} [options] optional see [`Query.prototype.setOptions()`](https://mongoosejs.com/docs/api.html#query_Query-setOptions)
|
|
3082
3099
|
* @param {Function} [callback] optional params are (error, mongooseDeleteResult)
|
|
3083
3100
|
* @return {Query} this
|
|
3084
|
-
* @see
|
|
3085
|
-
* @see
|
|
3101
|
+
* @see DeleteResult https://mongodb.github.io/node-mongodb-native/4.9/interfaces/DeleteResult.html
|
|
3102
|
+
* @see deleteOne https://mongodb.github.io/node-mongodb-native/4.9/classes/Collection.html#deleteOne
|
|
3086
3103
|
* @api public
|
|
3087
3104
|
*/
|
|
3088
3105
|
|
|
@@ -3118,8 +3135,13 @@ Query.prototype.deleteOne = function(filter, options, callback) {
|
|
|
3118
3135
|
return this;
|
|
3119
3136
|
};
|
|
3120
3137
|
|
|
3121
|
-
|
|
3138
|
+
/**
|
|
3122
3139
|
* Internal thunk for `deleteOne()`
|
|
3140
|
+
* @param {Function} callback
|
|
3141
|
+
* @method _deleteOne
|
|
3142
|
+
* @instance
|
|
3143
|
+
* @memberOf Query
|
|
3144
|
+
* @api private
|
|
3123
3145
|
*/
|
|
3124
3146
|
|
|
3125
3147
|
Query.prototype._deleteOne = wrapThunk(function(callback) {
|
|
@@ -3149,7 +3171,7 @@ Query.prototype._deleteOne = wrapThunk(function(callback) {
|
|
|
3149
3171
|
* // Using callbacks:
|
|
3150
3172
|
* Character.deleteMany({ name: /Stark/, age: { $gte: 18 } }, callback);
|
|
3151
3173
|
*
|
|
3152
|
-
* This function calls the MongoDB driver's [`Collection#deleteMany()` function](https://mongodb.github.io/node-mongodb-native/
|
|
3174
|
+
* This function calls the MongoDB driver's [`Collection#deleteMany()` function](https://mongodb.github.io/node-mongodb-native/4.9/classes/Collection.html#deleteMany).
|
|
3153
3175
|
* The returned [promise](https://mongoosejs.com/docs/queries.html) resolves to an
|
|
3154
3176
|
* object that contains 3 properties:
|
|
3155
3177
|
*
|
|
@@ -3167,8 +3189,8 @@ Query.prototype._deleteOne = wrapThunk(function(callback) {
|
|
|
3167
3189
|
* @param {Object} [options] optional see [`Query.prototype.setOptions()`](https://mongoosejs.com/docs/api.html#query_Query-setOptions)
|
|
3168
3190
|
* @param {Function} [callback] optional params are (error, mongooseDeleteResult)
|
|
3169
3191
|
* @return {Query} this
|
|
3170
|
-
* @see
|
|
3171
|
-
* @see
|
|
3192
|
+
* @see DeleteResult https://mongodb.github.io/node-mongodb-native/4.9/interfaces/DeleteResult.html
|
|
3193
|
+
* @see deleteMany https://mongodb.github.io/node-mongodb-native/4.9/classes/Collection.html#deleteMany
|
|
3172
3194
|
* @api public
|
|
3173
3195
|
*/
|
|
3174
3196
|
|
|
@@ -3204,8 +3226,13 @@ Query.prototype.deleteMany = function(filter, options, callback) {
|
|
|
3204
3226
|
return this;
|
|
3205
3227
|
};
|
|
3206
3228
|
|
|
3207
|
-
|
|
3229
|
+
/**
|
|
3208
3230
|
* Internal thunk around `deleteMany()`
|
|
3231
|
+
* @param {Function} callback
|
|
3232
|
+
* @method _deleteMany
|
|
3233
|
+
* @instance
|
|
3234
|
+
* @memberOf Query
|
|
3235
|
+
* @api private
|
|
3209
3236
|
*/
|
|
3210
3237
|
|
|
3211
3238
|
Query.prototype._deleteMany = wrapThunk(function(callback) {
|
|
@@ -3221,7 +3248,7 @@ Query.prototype._deleteMany = wrapThunk(function(callback) {
|
|
|
3221
3248
|
return Query.base.deleteMany.call(this, callback);
|
|
3222
3249
|
});
|
|
3223
3250
|
|
|
3224
|
-
|
|
3251
|
+
/**
|
|
3225
3252
|
* hydrates a document
|
|
3226
3253
|
*
|
|
3227
3254
|
* @param {Model} model
|
|
@@ -3231,6 +3258,7 @@ Query.prototype._deleteMany = wrapThunk(function(callback) {
|
|
|
3231
3258
|
* @param {Query} self
|
|
3232
3259
|
* @param {Array} [pop] array of paths used in population
|
|
3233
3260
|
* @param {Function} callback
|
|
3261
|
+
* @api private
|
|
3234
3262
|
*/
|
|
3235
3263
|
|
|
3236
3264
|
function completeOne(model, doc, res, options, fields, userProvidedFields, pop, callback) {
|
|
@@ -3265,8 +3293,10 @@ function completeOne(model, doc, res, options, fields, userProvidedFields, pop,
|
|
|
3265
3293
|
}
|
|
3266
3294
|
}
|
|
3267
3295
|
|
|
3268
|
-
|
|
3296
|
+
/**
|
|
3269
3297
|
* If the model is a discriminator type and not root, then add the key & value to the criteria.
|
|
3298
|
+
* @param {Query} query
|
|
3299
|
+
* @api private
|
|
3270
3300
|
*/
|
|
3271
3301
|
|
|
3272
3302
|
function prepareDiscriminatorCriteria(query) {
|
|
@@ -3301,7 +3331,7 @@ function prepareDiscriminatorCriteria(query) {
|
|
|
3301
3331
|
* - `maxTimeMS`: puts a time limit on the query - requires mongodb >= 2.6.0
|
|
3302
3332
|
* - `runValidators`: if true, runs [update validators](/docs/validation.html#update-validators) on this command. Update validators validate the update operation against the model's schema.
|
|
3303
3333
|
* - `setDefaultsOnInsert`: `true` by default. If `setDefaultsOnInsert` and `upsert` are true, mongoose will apply the [defaults](https://mongoosejs.com/docs/defaults.html) specified in the model's schema if a new document is created.
|
|
3304
|
-
* - `rawResult`: if true, returns the [raw result from the MongoDB driver](https://mongodb.github.io/node-mongodb-native/4.
|
|
3334
|
+
* - `rawResult`: if true, returns the [raw result from the MongoDB driver](https://mongodb.github.io/node-mongodb-native/4.9/interfaces/ModifyResult.html)
|
|
3305
3335
|
*
|
|
3306
3336
|
* #### Callback Signature
|
|
3307
3337
|
*
|
|
@@ -3327,7 +3357,7 @@ function prepareDiscriminatorCriteria(query) {
|
|
|
3327
3357
|
* @param {Object|Query} [filter]
|
|
3328
3358
|
* @param {Object} [doc]
|
|
3329
3359
|
* @param {Object} [options]
|
|
3330
|
-
* @param {Boolean} [options.rawResult] if true, returns the [raw result from the MongoDB driver](https://mongodb.github.io/node-mongodb-native/4.
|
|
3360
|
+
* @param {Boolean} [options.rawResult] if true, returns the [raw result from the MongoDB driver](https://mongodb.github.io/node-mongodb-native/4.9/interfaces/ModifyResult.html)
|
|
3331
3361
|
* @param {Boolean|String} [options.strict] overwrites the schema's [strict mode option](https://mongoosejs.com/docs/guide.html#strict)
|
|
3332
3362
|
* @param {ClientSession} [options.session=null] The session associated with this query. See [transactions docs](/docs/transactions.html).
|
|
3333
3363
|
* @param {Boolean} [options.multipleCastError] by default, mongoose only returns the first error that occurred in casting the query. Turn on this option to aggregate all the cast errors.
|
|
@@ -3339,8 +3369,9 @@ function prepareDiscriminatorCriteria(query) {
|
|
|
3339
3369
|
* @param {Boolean} [options.returnOriginal=null] An alias for the `new` option. `returnOriginal: false` is equivalent to `new: true`.
|
|
3340
3370
|
* @param {Function} [callback] optional params are (error, doc), _unless_ `rawResult` is used, in which case params are (error, writeOpResult)
|
|
3341
3371
|
* @see Tutorial /docs/tutorials/findoneandupdate.html
|
|
3342
|
-
* @see
|
|
3343
|
-
* @see
|
|
3372
|
+
* @see findAndModify command https://www.mongodb.com/docs/manual/reference/command/findAndModify/
|
|
3373
|
+
* @see ModifyResult https://mongodb.github.io/node-mongodb-native/4.9/interfaces/ModifyResult.html
|
|
3374
|
+
* @see findOneAndUpdate https://mongodb.github.io/node-mongodb-native/4.9/classes/Collection.html#findOneAndUpdate
|
|
3344
3375
|
* @return {Query} this
|
|
3345
3376
|
* @api public
|
|
3346
3377
|
*/
|
|
@@ -3415,10 +3446,12 @@ Query.prototype.findOneAndUpdate = function(criteria, doc, options, callback) {
|
|
|
3415
3446
|
return this;
|
|
3416
3447
|
};
|
|
3417
3448
|
|
|
3418
|
-
|
|
3449
|
+
/**
|
|
3419
3450
|
* Thunk around findOneAndUpdate()
|
|
3420
3451
|
*
|
|
3421
3452
|
* @param {Function} [callback]
|
|
3453
|
+
* @method _findOneAndUpdate
|
|
3454
|
+
* @memberOf Query
|
|
3422
3455
|
* @api private
|
|
3423
3456
|
*/
|
|
3424
3457
|
|
|
@@ -3444,7 +3477,7 @@ Query.prototype._findOneAndUpdate = wrapThunk(function(callback) {
|
|
|
3444
3477
|
*
|
|
3445
3478
|
* - `sort`: if multiple docs are found by the conditions, sets the sort order to choose which doc to update
|
|
3446
3479
|
* - `maxTimeMS`: puts a time limit on the query - requires mongodb >= 2.6.0
|
|
3447
|
-
* - `rawResult`: if true, resolves to the [raw result from the MongoDB driver](https://mongodb.github.io/node-mongodb-native/4.
|
|
3480
|
+
* - `rawResult`: if true, resolves to the [raw result from the MongoDB driver](https://mongodb.github.io/node-mongodb-native/4.9/interfaces/ModifyResult.html)
|
|
3448
3481
|
*
|
|
3449
3482
|
* #### Callback Signature
|
|
3450
3483
|
*
|
|
@@ -3467,12 +3500,12 @@ Query.prototype._findOneAndUpdate = wrapThunk(function(callback) {
|
|
|
3467
3500
|
* @instance
|
|
3468
3501
|
* @param {Object} [conditions]
|
|
3469
3502
|
* @param {Object} [options]
|
|
3470
|
-
* @param {Boolean} [options.rawResult] if true, returns the [raw result from the MongoDB driver](https://mongodb.github.io/node-mongodb-native/4.
|
|
3503
|
+
* @param {Boolean} [options.rawResult] if true, returns the [raw result from the MongoDB driver](https://mongodb.github.io/node-mongodb-native/4.9/interfaces/ModifyResult.html)
|
|
3471
3504
|
* @param {ClientSession} [options.session=null] The session associated with this query. See [transactions docs](/docs/transactions.html).
|
|
3472
3505
|
* @param {Boolean|String} [options.strict] overwrites the schema's [strict mode option](https://mongoosejs.com/docs/guide.html#strict)
|
|
3473
3506
|
* @param {Function} [callback] optional params are (error, document)
|
|
3474
3507
|
* @return {Query} this
|
|
3475
|
-
* @see
|
|
3508
|
+
* @see findAndModify command https://www.mongodb.com/docs/manual/reference/command/findAndModify/
|
|
3476
3509
|
* @api public
|
|
3477
3510
|
*/
|
|
3478
3511
|
|
|
@@ -3532,7 +3565,7 @@ Query.prototype.findOneAndRemove = function(conditions, options, callback) {
|
|
|
3532
3565
|
*
|
|
3533
3566
|
* - `sort`: if multiple docs are found by the conditions, sets the sort order to choose which doc to update
|
|
3534
3567
|
* - `maxTimeMS`: puts a time limit on the query - requires mongodb >= 2.6.0
|
|
3535
|
-
* - `rawResult`: if true, resolves to the [raw result from the MongoDB driver](https://mongodb.github.io/node-mongodb-native/4.
|
|
3568
|
+
* - `rawResult`: if true, resolves to the [raw result from the MongoDB driver](https://mongodb.github.io/node-mongodb-native/4.9/interfaces/ModifyResult.html)
|
|
3536
3569
|
*
|
|
3537
3570
|
* #### Callback Signature
|
|
3538
3571
|
*
|
|
@@ -3554,12 +3587,12 @@ Query.prototype.findOneAndRemove = function(conditions, options, callback) {
|
|
|
3554
3587
|
* @memberOf Query
|
|
3555
3588
|
* @param {Object} [conditions]
|
|
3556
3589
|
* @param {Object} [options]
|
|
3557
|
-
* @param {Boolean} [options.rawResult] if true, returns the [raw result from the MongoDB driver](https://mongodb.github.io/node-mongodb-native/4.
|
|
3590
|
+
* @param {Boolean} [options.rawResult] if true, returns the [raw result from the MongoDB driver](https://mongodb.github.io/node-mongodb-native/4.9/interfaces/ModifyResult.html)
|
|
3558
3591
|
* @param {ClientSession} [options.session=null] The session associated with this query. See [transactions docs](/docs/transactions.html).
|
|
3559
3592
|
* @param {Boolean|String} [options.strict] overwrites the schema's [strict mode option](https://mongoosejs.com/docs/guide.html#strict)
|
|
3560
3593
|
* @param {Function} [callback] optional params are (error, document)
|
|
3561
3594
|
* @return {Query} this
|
|
3562
|
-
* @see
|
|
3595
|
+
* @see findAndModify command https://www.mongodb.com/docs/manual/reference/command/findAndModify/
|
|
3563
3596
|
* @api public
|
|
3564
3597
|
*/
|
|
3565
3598
|
|
|
@@ -3599,11 +3632,13 @@ Query.prototype.findOneAndDelete = function(conditions, options, callback) {
|
|
|
3599
3632
|
return this;
|
|
3600
3633
|
};
|
|
3601
3634
|
|
|
3602
|
-
|
|
3635
|
+
/**
|
|
3603
3636
|
* Thunk around findOneAndDelete()
|
|
3604
3637
|
*
|
|
3605
3638
|
* @param {Function} [callback]
|
|
3606
3639
|
* @return {Query} this
|
|
3640
|
+
* @method _findOneAndDelete
|
|
3641
|
+
* @memberOf Query
|
|
3607
3642
|
* @api private
|
|
3608
3643
|
*/
|
|
3609
3644
|
Query.prototype._findOneAndDelete = wrapThunk(function(callback) {
|
|
@@ -3652,7 +3687,7 @@ Query.prototype._findOneAndDelete = wrapThunk(function(callback) {
|
|
|
3652
3687
|
*
|
|
3653
3688
|
* - `sort`: if multiple docs are found by the conditions, sets the sort order to choose which doc to update
|
|
3654
3689
|
* - `maxTimeMS`: puts a time limit on the query - requires mongodb >= 2.6.0
|
|
3655
|
-
* - `rawResult`: if true, resolves to the [raw result from the MongoDB driver](https://mongodb.github.io/node-mongodb-native/4.
|
|
3690
|
+
* - `rawResult`: if true, resolves to the [raw result from the MongoDB driver](https://mongodb.github.io/node-mongodb-native/4.9/interfaces/ModifyResult.html)
|
|
3656
3691
|
*
|
|
3657
3692
|
* #### Callback Signature
|
|
3658
3693
|
*
|
|
@@ -3675,7 +3710,7 @@ Query.prototype._findOneAndDelete = wrapThunk(function(callback) {
|
|
|
3675
3710
|
* @param {Object} [filter]
|
|
3676
3711
|
* @param {Object} [replacement]
|
|
3677
3712
|
* @param {Object} [options]
|
|
3678
|
-
* @param {Boolean} [options.rawResult] if true, returns the [raw result from the MongoDB driver](https://mongodb.github.io/node-mongodb-native/4.
|
|
3713
|
+
* @param {Boolean} [options.rawResult] if true, returns the [raw result from the MongoDB driver](https://mongodb.github.io/node-mongodb-native/4.9/interfaces/ModifyResult.html)
|
|
3679
3714
|
* @param {ClientSession} [options.session=null] The session associated with this query. See [transactions docs](/docs/transactions.html).
|
|
3680
3715
|
* @param {Boolean|String} [options.strict] overwrites the schema's [strict mode option](https://mongoosejs.com/docs/guide.html#strict)
|
|
3681
3716
|
* @param {Boolean} [options.new=false] By default, `findOneAndUpdate()` returns the document as it was **before** `update` was applied. If you set `new: true`, `findOneAndUpdate()` will instead give you the object after `update` was applied.
|
|
@@ -3750,11 +3785,14 @@ Query.prototype.findOneAndReplace = function(filter, replacement, options, callb
|
|
|
3750
3785
|
return this;
|
|
3751
3786
|
};
|
|
3752
3787
|
|
|
3753
|
-
|
|
3788
|
+
/**
|
|
3754
3789
|
* Thunk around findOneAndReplace()
|
|
3755
3790
|
*
|
|
3756
3791
|
* @param {Function} [callback]
|
|
3757
3792
|
* @return {Query} this
|
|
3793
|
+
* @method _findOneAndReplace
|
|
3794
|
+
* @instance
|
|
3795
|
+
* @memberOf Query
|
|
3758
3796
|
* @api private
|
|
3759
3797
|
*/
|
|
3760
3798
|
Query.prototype._findOneAndReplace = wrapThunk(function(callback) {
|
|
@@ -3827,9 +3865,10 @@ Query.prototype._findOneAndReplace = wrapThunk(function(callback) {
|
|
|
3827
3865
|
});
|
|
3828
3866
|
});
|
|
3829
3867
|
|
|
3830
|
-
|
|
3868
|
+
/**
|
|
3831
3869
|
* Support the `new` option as an alternative to `returnOriginal` for backwards
|
|
3832
3870
|
* compat.
|
|
3871
|
+
* @api private
|
|
3833
3872
|
*/
|
|
3834
3873
|
|
|
3835
3874
|
function convertNewToReturnDocument(options) {
|
|
@@ -3847,11 +3886,14 @@ function convertNewToReturnDocument(options) {
|
|
|
3847
3886
|
}
|
|
3848
3887
|
}
|
|
3849
3888
|
|
|
3850
|
-
|
|
3889
|
+
/**
|
|
3851
3890
|
* Thunk around findOneAndRemove()
|
|
3852
3891
|
*
|
|
3853
3892
|
* @param {Function} [callback]
|
|
3854
3893
|
* @return {Query} this
|
|
3894
|
+
* @method _findOneAndRemove
|
|
3895
|
+
* @memberOf Query
|
|
3896
|
+
* @instance
|
|
3855
3897
|
* @api private
|
|
3856
3898
|
*/
|
|
3857
3899
|
Query.prototype._findOneAndRemove = wrapThunk(function(callback) {
|
|
@@ -3863,8 +3905,12 @@ Query.prototype._findOneAndRemove = wrapThunk(function(callback) {
|
|
|
3863
3905
|
this._findAndModify('remove', callback);
|
|
3864
3906
|
});
|
|
3865
3907
|
|
|
3866
|
-
|
|
3908
|
+
/**
|
|
3867
3909
|
* Get options from query opts, falling back to the base mongoose object.
|
|
3910
|
+
* @param {Query} query
|
|
3911
|
+
* @param {Object} option
|
|
3912
|
+
* @param {Any} def
|
|
3913
|
+
* @api private
|
|
3868
3914
|
*/
|
|
3869
3915
|
|
|
3870
3916
|
function _getOption(query, option, def) {
|
|
@@ -3879,11 +3925,14 @@ function _getOption(query, option, def) {
|
|
|
3879
3925
|
return def;
|
|
3880
3926
|
}
|
|
3881
3927
|
|
|
3882
|
-
|
|
3928
|
+
/**
|
|
3883
3929
|
* Override mquery.prototype._findAndModify to provide casting etc.
|
|
3884
3930
|
*
|
|
3885
3931
|
* @param {String} type either "remove" or "update"
|
|
3886
3932
|
* @param {Function} callback
|
|
3933
|
+
* @method _findAndModify
|
|
3934
|
+
* @memberOf Query
|
|
3935
|
+
* @instance
|
|
3887
3936
|
* @api private
|
|
3888
3937
|
*/
|
|
3889
3938
|
|
|
@@ -4094,11 +4143,14 @@ function _completeManyLean(schema, docs, path, opts, callback) {
|
|
|
4094
4143
|
}
|
|
4095
4144
|
return callback(null, docs);
|
|
4096
4145
|
}
|
|
4097
|
-
|
|
4146
|
+
/**
|
|
4098
4147
|
* Override mquery.prototype._mergeUpdate to handle mongoose objects in
|
|
4099
4148
|
* updates.
|
|
4100
4149
|
*
|
|
4101
4150
|
* @param {Object} doc
|
|
4151
|
+
* @method _mergeUpdate
|
|
4152
|
+
* @memberOf Query
|
|
4153
|
+
* @instance
|
|
4102
4154
|
* @api private
|
|
4103
4155
|
*/
|
|
4104
4156
|
|
|
@@ -4130,9 +4182,12 @@ Query.prototype._mergeUpdate = function(doc) {
|
|
|
4130
4182
|
}
|
|
4131
4183
|
};
|
|
4132
4184
|
|
|
4133
|
-
|
|
4185
|
+
/**
|
|
4134
4186
|
* The mongodb driver 1.3.23 only supports the nested array sort
|
|
4135
4187
|
* syntax. We must convert it or sorting findAndModify will not work.
|
|
4188
|
+
* @param {Object} opts
|
|
4189
|
+
* @param {Array|Object} opts.sort
|
|
4190
|
+
* @api private
|
|
4136
4191
|
*/
|
|
4137
4192
|
|
|
4138
4193
|
function convertSortToArray(opts) {
|
|
@@ -4229,13 +4284,17 @@ function _updateThunk(op, callback) {
|
|
|
4229
4284
|
return null;
|
|
4230
4285
|
}
|
|
4231
4286
|
|
|
4232
|
-
|
|
4287
|
+
/**
|
|
4233
4288
|
* Mongoose calls this function internally to validate the query if
|
|
4234
4289
|
* `runValidators` is set
|
|
4235
4290
|
*
|
|
4236
4291
|
* @param {Object} castedDoc the update, after casting
|
|
4237
4292
|
* @param {Object} options the options from `_optionsForExec()`
|
|
4293
|
+
* @param {Boolean} isOverwriting
|
|
4238
4294
|
* @param {Function} callback
|
|
4295
|
+
* @method validate
|
|
4296
|
+
* @memberOf Query
|
|
4297
|
+
* @instance
|
|
4239
4298
|
* @api private
|
|
4240
4299
|
*/
|
|
4241
4300
|
|
|
@@ -4255,44 +4314,56 @@ Query.prototype.validate = function validate(castedDoc, options, isOverwriting,
|
|
|
4255
4314
|
});
|
|
4256
4315
|
};
|
|
4257
4316
|
|
|
4258
|
-
|
|
4317
|
+
/**
|
|
4259
4318
|
* Internal thunk for .update()
|
|
4260
4319
|
*
|
|
4261
4320
|
* @param {Function} callback
|
|
4262
4321
|
* @see Model.update #model_Model-update
|
|
4322
|
+
* @method _execUpdate
|
|
4323
|
+
* @memberOf Query
|
|
4324
|
+
* @instance
|
|
4263
4325
|
* @api private
|
|
4264
4326
|
*/
|
|
4265
4327
|
Query.prototype._execUpdate = wrapThunk(function(callback) {
|
|
4266
4328
|
return _updateThunk.call(this, 'update', callback);
|
|
4267
4329
|
});
|
|
4268
4330
|
|
|
4269
|
-
|
|
4331
|
+
/**
|
|
4270
4332
|
* Internal thunk for .updateMany()
|
|
4271
4333
|
*
|
|
4272
4334
|
* @param {Function} callback
|
|
4273
4335
|
* @see Model.update #model_Model-update
|
|
4336
|
+
* @method _updateMany
|
|
4337
|
+
* @memberOf Query
|
|
4338
|
+
* @instance
|
|
4274
4339
|
* @api private
|
|
4275
4340
|
*/
|
|
4276
4341
|
Query.prototype._updateMany = wrapThunk(function(callback) {
|
|
4277
4342
|
return _updateThunk.call(this, 'updateMany', callback);
|
|
4278
4343
|
});
|
|
4279
4344
|
|
|
4280
|
-
|
|
4345
|
+
/**
|
|
4281
4346
|
* Internal thunk for .updateOne()
|
|
4282
4347
|
*
|
|
4283
4348
|
* @param {Function} callback
|
|
4284
4349
|
* @see Model.update #model_Model-update
|
|
4350
|
+
* @method _updateOne
|
|
4351
|
+
* @memberOf Query
|
|
4352
|
+
* @instance
|
|
4285
4353
|
* @api private
|
|
4286
4354
|
*/
|
|
4287
4355
|
Query.prototype._updateOne = wrapThunk(function(callback) {
|
|
4288
4356
|
return _updateThunk.call(this, 'updateOne', callback);
|
|
4289
4357
|
});
|
|
4290
4358
|
|
|
4291
|
-
|
|
4359
|
+
/**
|
|
4292
4360
|
* Internal thunk for .replaceOne()
|
|
4293
4361
|
*
|
|
4294
4362
|
* @param {Function} callback
|
|
4295
4363
|
* @see Model.replaceOne #model_Model-replaceOne
|
|
4364
|
+
* @method _replaceOne
|
|
4365
|
+
* @memberOf Query
|
|
4366
|
+
* @instance
|
|
4296
4367
|
* @api private
|
|
4297
4368
|
*/
|
|
4298
4369
|
Query.prototype._replaceOne = wrapThunk(function(callback) {
|
|
@@ -4385,7 +4456,7 @@ Query.prototype._replaceOne = wrapThunk(function(callback) {
|
|
|
4385
4456
|
* @see Model.update #model_Model-update
|
|
4386
4457
|
* @see Query docs https://mongoosejs.com/docs/queries.html
|
|
4387
4458
|
* @see update https://docs.mongodb.org/manual/reference/method/db.collection.update/
|
|
4388
|
-
* @see
|
|
4459
|
+
* @see UpdateResult https://mongodb.github.io/node-mongodb-native/4.9/interfaces/UpdateResult.html
|
|
4389
4460
|
* @see MongoDB docs https://docs.mongodb.com/manual/reference/command/update/#update-command-output
|
|
4390
4461
|
* @api public
|
|
4391
4462
|
*/
|
|
@@ -4450,7 +4521,7 @@ Query.prototype.update = function(conditions, doc, options, callback) {
|
|
|
4450
4521
|
* @see Model.update #model_Model-update
|
|
4451
4522
|
* @see Query docs https://mongoosejs.com/docs/queries.html
|
|
4452
4523
|
* @see update https://docs.mongodb.org/manual/reference/method/db.collection.update/
|
|
4453
|
-
* @see
|
|
4524
|
+
* @see UpdateResult https://mongodb.github.io/node-mongodb-native/4.9/interfaces/UpdateResult.html
|
|
4454
4525
|
* @see MongoDB docs https://docs.mongodb.com/manual/reference/command/update/#update-command-output
|
|
4455
4526
|
* @api public
|
|
4456
4527
|
*/
|
|
@@ -4516,7 +4587,7 @@ Query.prototype.updateMany = function(conditions, doc, options, callback) {
|
|
|
4516
4587
|
* @see Model.update #model_Model-update
|
|
4517
4588
|
* @see Query docs https://mongoosejs.com/docs/queries.html
|
|
4518
4589
|
* @see update https://docs.mongodb.org/manual/reference/method/db.collection.update/
|
|
4519
|
-
* @see
|
|
4590
|
+
* @see UpdateResult https://mongodb.github.io/node-mongodb-native/4.9/interfaces/UpdateResult.html
|
|
4520
4591
|
* @see MongoDB docs https://docs.mongodb.com/manual/reference/command/update/#update-command-output
|
|
4521
4592
|
* @api public
|
|
4522
4593
|
*/
|
|
@@ -4580,7 +4651,7 @@ Query.prototype.updateOne = function(conditions, doc, options, callback) {
|
|
|
4580
4651
|
* @see Model.update #model_Model-update
|
|
4581
4652
|
* @see Query docs https://mongoosejs.com/docs/queries.html
|
|
4582
4653
|
* @see update https://docs.mongodb.org/manual/reference/method/db.collection.update/
|
|
4583
|
-
* @see
|
|
4654
|
+
* @see UpdateResult https://mongodb.github.io/node-mongodb-native/4.9/interfaces/UpdateResult.html
|
|
4584
4655
|
* @see MongoDB docs https://docs.mongodb.com/manual/reference/command/update/#update-command-output
|
|
4585
4656
|
* @api public
|
|
4586
4657
|
*/
|
|
@@ -4614,8 +4685,15 @@ Query.prototype.replaceOne = function(conditions, doc, options, callback) {
|
|
|
4614
4685
|
return _update(this, 'replaceOne', conditions, doc, options, callback);
|
|
4615
4686
|
};
|
|
4616
4687
|
|
|
4617
|
-
|
|
4688
|
+
/**
|
|
4618
4689
|
* Internal helper for update, updateMany, updateOne, replaceOne
|
|
4690
|
+
* @param {Query} query
|
|
4691
|
+
* @param {String} op
|
|
4692
|
+
* @param {Object} filter
|
|
4693
|
+
* @param {Document} [doc]
|
|
4694
|
+
* @param {Object} [options]
|
|
4695
|
+
* @param {Function} callback
|
|
4696
|
+
* @api private
|
|
4619
4697
|
*/
|
|
4620
4698
|
|
|
4621
4699
|
function _update(query, op, filter, doc, options, callback) {
|
|
@@ -4763,8 +4841,11 @@ Query.prototype.orFail = function(err) {
|
|
|
4763
4841
|
return this;
|
|
4764
4842
|
};
|
|
4765
4843
|
|
|
4766
|
-
|
|
4844
|
+
/**
|
|
4767
4845
|
* Get the error to throw for `orFail()`
|
|
4846
|
+
* @param {Error|undefined} err
|
|
4847
|
+
* @param {Query} query
|
|
4848
|
+
* @api private
|
|
4768
4849
|
*/
|
|
4769
4850
|
|
|
4770
4851
|
function _orFailError(err, query) {
|
|
@@ -4970,11 +5051,15 @@ Query.prototype.post = function(fn) {
|
|
|
4970
5051
|
return this;
|
|
4971
5052
|
};
|
|
4972
5053
|
|
|
4973
|
-
|
|
5054
|
+
/**
|
|
4974
5055
|
* Casts obj for an update command.
|
|
4975
5056
|
*
|
|
4976
5057
|
* @param {Object} obj
|
|
5058
|
+
* @param {Boolean} overwrite
|
|
4977
5059
|
* @return {Object} obj after casting its values
|
|
5060
|
+
* @method _castUpdate
|
|
5061
|
+
* @memberOf Query
|
|
5062
|
+
* @instance
|
|
4978
5063
|
* @api private
|
|
4979
5064
|
*/
|
|
4980
5065
|
|
|
@@ -5018,7 +5103,7 @@ Query.prototype._castUpdate = function _castUpdate(obj, overwrite) {
|
|
|
5018
5103
|
}, this, this._conditions);
|
|
5019
5104
|
};
|
|
5020
5105
|
|
|
5021
|
-
|
|
5106
|
+
/**
|
|
5022
5107
|
* castQuery
|
|
5023
5108
|
* @api private
|
|
5024
5109
|
*/
|
|
@@ -5312,7 +5397,7 @@ Query.prototype._applyPaths = function applyPaths() {
|
|
|
5312
5397
|
};
|
|
5313
5398
|
|
|
5314
5399
|
/**
|
|
5315
|
-
* Returns a wrapper around a [mongodb driver cursor](https://mongodb.github.io/node-mongodb-native/
|
|
5400
|
+
* Returns a wrapper around a [mongodb driver cursor](https://mongodb.github.io/node-mongodb-native/4.9/classes/FindCursor.html).
|
|
5316
5401
|
* A QueryCursor exposes a Streams3 interface, as well as a `.next()` function.
|
|
5317
5402
|
*
|
|
5318
5403
|
* The `.cursor()` function triggers pre find hooks, but **not** post find hooks.
|
|
@@ -5533,7 +5618,7 @@ Query.prototype.tailable = function(val, opts) {
|
|
|
5533
5618
|
* @api public
|
|
5534
5619
|
*/
|
|
5535
5620
|
|
|
5536
|
-
|
|
5621
|
+
/**
|
|
5537
5622
|
* Overwriting mquery is needed to support a couple different near() forms found in older
|
|
5538
5623
|
* versions of mongoose
|
|
5539
5624
|
* near([1,1])
|
|
@@ -5541,6 +5626,11 @@ Query.prototype.tailable = function(val, opts) {
|
|
|
5541
5626
|
* near(field, [1,2])
|
|
5542
5627
|
* near(field, 1, 2)
|
|
5543
5628
|
* In addition to all of the normal forms supported by mquery
|
|
5629
|
+
*
|
|
5630
|
+
* @method near
|
|
5631
|
+
* @memberOf Query
|
|
5632
|
+
* @instance
|
|
5633
|
+
* @api private
|
|
5544
5634
|
*/
|
|
5545
5635
|
|
|
5546
5636
|
Query.prototype.near = function() {
|
|
@@ -5692,10 +5782,15 @@ if (Symbol.asyncIterator != null) {
|
|
|
5692
5782
|
* @api public
|
|
5693
5783
|
*/
|
|
5694
5784
|
|
|
5695
|
-
|
|
5785
|
+
/**
|
|
5696
5786
|
* this is needed to support the mongoose syntax of:
|
|
5697
5787
|
* box(field, { ll : [x,y], ur : [x2,y2] })
|
|
5698
5788
|
* box({ ll : [x,y], ur : [x2,y2] })
|
|
5789
|
+
*
|
|
5790
|
+
* @method box
|
|
5791
|
+
* @memberOf Query
|
|
5792
|
+
* @instance
|
|
5793
|
+
* @api private
|
|
5699
5794
|
*/
|
|
5700
5795
|
|
|
5701
5796
|
Query.prototype.box = function(ll, ur) {
|