mongoose 8.16.0 → 8.16.1
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 +1 -1
- package/lib/model.js +1 -1
- package/lib/schema/bigint.js +7 -2
- package/lib/schema/boolean.js +7 -2
- package/lib/schema/buffer.js +7 -1
- package/lib/schema/date.js +5 -1
- package/lib/schema/decimal128.js +6 -1
- package/lib/schema/double.js +6 -1
- package/lib/schema/int32.js +7 -2
- package/lib/schema/number.js +6 -1
- package/lib/schema/objectId.js +6 -1
- package/lib/schema/string.js +1 -3
- package/lib/schema/uuid.js +6 -1
- package/package.json +1 -1
package/lib/document.js
CHANGED
|
@@ -1114,7 +1114,7 @@ Document.prototype.$set = function $set(path, val, type, options) {
|
|
|
1114
1114
|
}
|
|
1115
1115
|
|
|
1116
1116
|
if (utils.isNonBuiltinObject(valForKey) && pathtype === 'nested') {
|
|
1117
|
-
this.$set(pathName, valForKey, constructing,
|
|
1117
|
+
this.$set(pathName, valForKey, constructing, options);
|
|
1118
1118
|
$applyDefaultsToNested(this.$get(pathName), pathName, this);
|
|
1119
1119
|
continue;
|
|
1120
1120
|
} else if (strict) {
|
package/lib/model.js
CHANGED
|
@@ -532,7 +532,7 @@ Model.prototype.$__save = function(options, callback) {
|
|
|
532
532
|
this.$__undoReset();
|
|
533
533
|
const err = this.$__.$versionError ||
|
|
534
534
|
new VersionError(this, version, this.$__.modifiedPaths);
|
|
535
|
-
return callback(err);
|
|
535
|
+
return callback(err, this);
|
|
536
536
|
}
|
|
537
537
|
|
|
538
538
|
// increment version if was successful
|
package/lib/schema/bigint.js
CHANGED
|
@@ -177,7 +177,7 @@ SchemaBigInt.prototype.cast = function(value) {
|
|
|
177
177
|
* ignore
|
|
178
178
|
*/
|
|
179
179
|
|
|
180
|
-
|
|
180
|
+
const $conditionalHandlers = {
|
|
181
181
|
...SchemaType.prototype.$conditionalHandlers,
|
|
182
182
|
$gt: handleSingle,
|
|
183
183
|
$gte: handleSingle,
|
|
@@ -185,6 +185,11 @@ SchemaBigInt.$conditionalHandlers = {
|
|
|
185
185
|
$lte: handleSingle
|
|
186
186
|
};
|
|
187
187
|
|
|
188
|
+
Object.defineProperty(SchemaBigInt.prototype, '$conditionalHandlers', {
|
|
189
|
+
enumerable: false,
|
|
190
|
+
value: $conditionalHandlers
|
|
191
|
+
});
|
|
192
|
+
|
|
188
193
|
/*!
|
|
189
194
|
* ignore
|
|
190
195
|
*/
|
|
@@ -204,7 +209,7 @@ function handleSingle(val, context) {
|
|
|
204
209
|
SchemaBigInt.prototype.castForQuery = function($conditional, val, context) {
|
|
205
210
|
let handler;
|
|
206
211
|
if ($conditional != null) {
|
|
207
|
-
handler =
|
|
212
|
+
handler = this.$conditionalHandlers[$conditional];
|
|
208
213
|
|
|
209
214
|
if (handler) {
|
|
210
215
|
return handler.call(this, val);
|
package/lib/schema/boolean.js
CHANGED
|
@@ -235,7 +235,12 @@ SchemaBoolean.prototype.cast = function(value) {
|
|
|
235
235
|
}
|
|
236
236
|
};
|
|
237
237
|
|
|
238
|
-
|
|
238
|
+
const $conditionalHandlers = { ...SchemaType.prototype.$conditionalHandlers };
|
|
239
|
+
|
|
240
|
+
Object.defineProperty(SchemaBoolean.prototype, '$conditionalHandlers', {
|
|
241
|
+
enumerable: false,
|
|
242
|
+
value: $conditionalHandlers
|
|
243
|
+
});
|
|
239
244
|
|
|
240
245
|
/**
|
|
241
246
|
* Casts contents for queries.
|
|
@@ -248,7 +253,7 @@ SchemaBoolean.$conditionalHandlers = { ...SchemaType.prototype.$conditionalHandl
|
|
|
248
253
|
SchemaBoolean.prototype.castForQuery = function($conditional, val, context) {
|
|
249
254
|
let handler;
|
|
250
255
|
if ($conditional != null) {
|
|
251
|
-
handler =
|
|
256
|
+
handler = this.$conditionalHandlers[$conditional];
|
|
252
257
|
|
|
253
258
|
if (handler) {
|
|
254
259
|
return handler.call(this, val);
|
package/lib/schema/buffer.js
CHANGED
|
@@ -259,7 +259,7 @@ function handleSingle(val, context) {
|
|
|
259
259
|
return this.castForQuery(null, val, context);
|
|
260
260
|
}
|
|
261
261
|
|
|
262
|
-
|
|
262
|
+
const $conditionalHandlers = {
|
|
263
263
|
...SchemaType.prototype.$conditionalHandlers,
|
|
264
264
|
$bitsAllClear: handleBitwiseOperator,
|
|
265
265
|
$bitsAnyClear: handleBitwiseOperator,
|
|
@@ -271,6 +271,12 @@ SchemaBuffer.prototype.$conditionalHandlers = {
|
|
|
271
271
|
$lte: handleSingle
|
|
272
272
|
};
|
|
273
273
|
|
|
274
|
+
Object.defineProperty(SchemaBuffer.prototype, '$conditionalHandlers', {
|
|
275
|
+
enumerable: false,
|
|
276
|
+
value: $conditionalHandlers
|
|
277
|
+
});
|
|
278
|
+
|
|
279
|
+
|
|
274
280
|
/**
|
|
275
281
|
* Casts contents for queries.
|
|
276
282
|
*
|
package/lib/schema/date.js
CHANGED
|
@@ -389,7 +389,7 @@ function handleSingle(val) {
|
|
|
389
389
|
return this.cast(val);
|
|
390
390
|
}
|
|
391
391
|
|
|
392
|
-
|
|
392
|
+
const $conditionalHandlers = {
|
|
393
393
|
...SchemaType.prototype.$conditionalHandlers,
|
|
394
394
|
$gt: handleSingle,
|
|
395
395
|
$gte: handleSingle,
|
|
@@ -397,6 +397,10 @@ SchemaDate.prototype.$conditionalHandlers = {
|
|
|
397
397
|
$lte: handleSingle
|
|
398
398
|
};
|
|
399
399
|
|
|
400
|
+
Object.defineProperty(SchemaDate.prototype, '$conditionalHandlers', {
|
|
401
|
+
enumerable: false,
|
|
402
|
+
value: $conditionalHandlers
|
|
403
|
+
});
|
|
400
404
|
|
|
401
405
|
/**
|
|
402
406
|
* Casts contents for queries.
|
package/lib/schema/decimal128.js
CHANGED
|
@@ -214,7 +214,7 @@ function handleSingle(val) {
|
|
|
214
214
|
return this.cast(val);
|
|
215
215
|
}
|
|
216
216
|
|
|
217
|
-
|
|
217
|
+
const $conditionalHandlers = {
|
|
218
218
|
...SchemaType.prototype.$conditionalHandlers,
|
|
219
219
|
$gt: handleSingle,
|
|
220
220
|
$gte: handleSingle,
|
|
@@ -222,6 +222,11 @@ SchemaDecimal128.prototype.$conditionalHandlers = {
|
|
|
222
222
|
$lte: handleSingle
|
|
223
223
|
};
|
|
224
224
|
|
|
225
|
+
Object.defineProperty(SchemaDecimal128.prototype, '$conditionalHandlers', {
|
|
226
|
+
enumerable: false,
|
|
227
|
+
value: $conditionalHandlers
|
|
228
|
+
});
|
|
229
|
+
|
|
225
230
|
/**
|
|
226
231
|
* Returns this schema type's representation in a JSON schema.
|
|
227
232
|
*
|
package/lib/schema/double.js
CHANGED
|
@@ -197,7 +197,7 @@ function handleSingle(val) {
|
|
|
197
197
|
return this.cast(val);
|
|
198
198
|
}
|
|
199
199
|
|
|
200
|
-
|
|
200
|
+
const $conditionalHandlers = {
|
|
201
201
|
...SchemaType.prototype.$conditionalHandlers,
|
|
202
202
|
$gt: handleSingle,
|
|
203
203
|
$gte: handleSingle,
|
|
@@ -205,6 +205,11 @@ SchemaDouble.prototype.$conditionalHandlers = {
|
|
|
205
205
|
$lte: handleSingle
|
|
206
206
|
};
|
|
207
207
|
|
|
208
|
+
Object.defineProperty(SchemaDouble.prototype, '$conditionalHandlers', {
|
|
209
|
+
enumerable: false,
|
|
210
|
+
value: $conditionalHandlers
|
|
211
|
+
});
|
|
212
|
+
|
|
208
213
|
/**
|
|
209
214
|
* Returns this schema type's representation in a JSON schema.
|
|
210
215
|
*
|
package/lib/schema/int32.js
CHANGED
|
@@ -197,7 +197,7 @@ SchemaInt32.prototype.cast = function(value) {
|
|
|
197
197
|
* ignore
|
|
198
198
|
*/
|
|
199
199
|
|
|
200
|
-
|
|
200
|
+
const $conditionalHandlers = {
|
|
201
201
|
...SchemaType.prototype.$conditionalHandlers,
|
|
202
202
|
$gt: handleSingle,
|
|
203
203
|
$gte: handleSingle,
|
|
@@ -209,6 +209,11 @@ SchemaInt32.$conditionalHandlers = {
|
|
|
209
209
|
$bitsAnySet: handleBitwiseOperator
|
|
210
210
|
};
|
|
211
211
|
|
|
212
|
+
Object.defineProperty(SchemaInt32.prototype, '$conditionalHandlers', {
|
|
213
|
+
enumerable: false,
|
|
214
|
+
value: $conditionalHandlers
|
|
215
|
+
});
|
|
216
|
+
|
|
212
217
|
/*!
|
|
213
218
|
* ignore
|
|
214
219
|
*/
|
|
@@ -228,7 +233,7 @@ function handleSingle(val, context) {
|
|
|
228
233
|
SchemaInt32.prototype.castForQuery = function($conditional, val, context) {
|
|
229
234
|
let handler;
|
|
230
235
|
if ($conditional != null) {
|
|
231
|
-
handler =
|
|
236
|
+
handler = this.$conditionalHandlers[$conditional];
|
|
232
237
|
|
|
233
238
|
if (handler) {
|
|
234
239
|
return handler.call(this, val);
|
package/lib/schema/number.js
CHANGED
|
@@ -400,7 +400,7 @@ function handleArray(val) {
|
|
|
400
400
|
});
|
|
401
401
|
}
|
|
402
402
|
|
|
403
|
-
|
|
403
|
+
const $conditionalHandlers = {
|
|
404
404
|
...SchemaType.prototype.$conditionalHandlers,
|
|
405
405
|
$bitsAllClear: handleBitwiseOperator,
|
|
406
406
|
$bitsAnyClear: handleBitwiseOperator,
|
|
@@ -413,6 +413,11 @@ SchemaNumber.prototype.$conditionalHandlers = {
|
|
|
413
413
|
$mod: handleArray
|
|
414
414
|
};
|
|
415
415
|
|
|
416
|
+
Object.defineProperty(SchemaNumber.prototype, '$conditionalHandlers', {
|
|
417
|
+
enumerable: false,
|
|
418
|
+
value: $conditionalHandlers
|
|
419
|
+
});
|
|
420
|
+
|
|
416
421
|
/**
|
|
417
422
|
* Casts contents for queries.
|
|
418
423
|
*
|
package/lib/schema/objectId.js
CHANGED
|
@@ -260,7 +260,7 @@ function handleSingle(val) {
|
|
|
260
260
|
return this.cast(val);
|
|
261
261
|
}
|
|
262
262
|
|
|
263
|
-
|
|
263
|
+
const $conditionalHandlers = {
|
|
264
264
|
...SchemaType.prototype.$conditionalHandlers,
|
|
265
265
|
$gt: handleSingle,
|
|
266
266
|
$gte: handleSingle,
|
|
@@ -268,6 +268,11 @@ SchemaObjectId.prototype.$conditionalHandlers = {
|
|
|
268
268
|
$lte: handleSingle
|
|
269
269
|
};
|
|
270
270
|
|
|
271
|
+
Object.defineProperty(SchemaObjectId.prototype, '$conditionalHandlers', {
|
|
272
|
+
enumerable: false,
|
|
273
|
+
value: $conditionalHandlers
|
|
274
|
+
});
|
|
275
|
+
|
|
271
276
|
/*!
|
|
272
277
|
* ignore
|
|
273
278
|
*/
|
package/lib/schema/string.js
CHANGED
|
@@ -661,10 +661,8 @@ const $conditionalHandlers = {
|
|
|
661
661
|
};
|
|
662
662
|
|
|
663
663
|
Object.defineProperty(SchemaString.prototype, '$conditionalHandlers', {
|
|
664
|
-
configurable: false,
|
|
665
664
|
enumerable: false,
|
|
666
|
-
|
|
667
|
-
value: Object.freeze($conditionalHandlers)
|
|
665
|
+
value: $conditionalHandlers
|
|
668
666
|
});
|
|
669
667
|
|
|
670
668
|
/**
|
package/lib/schema/uuid.js
CHANGED
|
@@ -242,7 +242,7 @@ function handleArray(val) {
|
|
|
242
242
|
});
|
|
243
243
|
}
|
|
244
244
|
|
|
245
|
-
|
|
245
|
+
const $conditionalHandlers = {
|
|
246
246
|
...SchemaType.prototype.$conditionalHandlers,
|
|
247
247
|
$bitsAllClear: handleBitwiseOperator,
|
|
248
248
|
$bitsAnyClear: handleBitwiseOperator,
|
|
@@ -258,6 +258,11 @@ SchemaUUID.prototype.$conditionalHandlers = {
|
|
|
258
258
|
$nin: handleArray
|
|
259
259
|
};
|
|
260
260
|
|
|
261
|
+
Object.defineProperty(SchemaUUID.prototype, '$conditionalHandlers', {
|
|
262
|
+
enumerable: false,
|
|
263
|
+
value: $conditionalHandlers
|
|
264
|
+
});
|
|
265
|
+
|
|
261
266
|
/**
|
|
262
267
|
* Casts contents for queries.
|
|
263
268
|
*
|