mongoose 5.13.1 → 5.13.2
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/History.md +9 -0
- package/dist/browser.umd.js +5 -1
- package/index.d.ts +8 -3
- package/lib/schema/array.js +4 -2
- package/lib/schema.js +8 -8
- package/package.json +2 -1
package/History.md
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
5.13.2 / 2021-07-03
|
|
2
|
+
===================
|
|
3
|
+
* fix: hardcode @types/node version for now to avoid breaking changes from DefinitelyTyped/DefinitelyTyped#53669 #10415
|
|
4
|
+
* fix(index.d.ts): allow using type: Date with Date paths in SchemaDefinitionType #10409
|
|
5
|
+
* fix(index.d.ts): allow extra VirtualTypeOptions for better plugin support #10412
|
|
6
|
+
* docs(api): add SchemaArray to docs #10397
|
|
7
|
+
* docs(schema+validation): fix broken links #10396
|
|
8
|
+
* docs(transactions): add note about creating a connection to transactions docs #10406
|
|
9
|
+
|
|
1
10
|
5.13.1 / 2021-07-02
|
|
2
11
|
===================
|
|
3
12
|
* fix(discriminator): allow using array as discriminator key in schema and as tied value #10303
|
package/dist/browser.umd.js
CHANGED
|
@@ -704,7 +704,11 @@ t.exports=o},function(t,e,r){"use strict";
|
|
|
704
704
|
*/e.String=r(148),e.Number=r(79),e.Boolean=r(152),e.DocumentArray=r(153),e.Embedded=r(160),e.Array=r(56),e.Buffer=r(162),e.Date=r(164),e.ObjectId=r(167),e.Mixed=r(26),e.Decimal128=e.Decimal=r(169),e.Map=r(171),e.Oid=e.ObjectId,e.Object=e.Mixed,e.Bool=e.Boolean,e.ObjectID=e.ObjectId},function(t,e,r){"use strict";
|
|
705
705
|
/*!
|
|
706
706
|
* Module dependencies.
|
|
707
|
-
*/function n(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return o(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return o(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,a=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){u=!0,s=t},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw s}}}}function o(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var i,s,a=r(51),u=r(73),c=r(14),l=r(154),f=r(6),p=f.CastError,h=r(26),y=r(155),d=r(156),_=r(3),v=r(82),m=r(4),g=r(1),b=r(35).castToNumber,w=r(83),O=r(36),S=Symbol("mongoose#isNestedArray"),A=Object.freeze({});function $(t,e,n,o){s||(s=r(37).Embedded);var i,a,u="type";if(o&&o.typeKey&&(u=o.typeKey),this.schemaOptions=o,e){var c={};g.isPOJO(e)&&(e[u]?(delete(c=g.clone(e))[u],e=e[u]):e=h),null!=n&&null!=n.ref&&null==c.ref&&(c.ref=n.ref),e===Object&&(e=h);var l="string"==typeof e?e:g.getFunctionName(e),p=r(55),y=p.hasOwnProperty(l)?p[l]:e;if(this.casterConstructor=y,this.casterConstructor instanceof $&&(this.casterConstructor[S]=!0),"function"!=typeof y||y.$isArraySubdocument||y.$isSchemaMap)this.caster=y,this.caster instanceof s||(this.caster.path=t);else{var d=this.caster instanceof s?null:t;this.caster=new y(d,c)}this.$embeddedSchemaType=this.caster}if(this.$isMongooseArray=!0,f.call(this,t,n,"Array"),null!=this.defaultValue&&(i=this.defaultValue,a="function"==typeof i),!("defaultValue"in this)||void 0!==this.defaultValue){var _=function(){var t=[];return a?t=i.call(this):null!=i&&(t=t.concat(i)),t};_.$runBeforeSetters=!a,this.default(_)}}$.schemaName="Array",$.options={castNonArrays:!0}
|
|
707
|
+
*/function n(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return o(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return o(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,a=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){u=!0,s=t},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw s}}}}function o(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var i,s,a=r(51),u=r(73),c=r(14),l=r(154),f=r(6),p=f.CastError,h=r(26),y=r(155),d=r(156),_=r(3),v=r(82),m=r(4),g=r(1),b=r(35).castToNumber,w=r(83),O=r(36),S=Symbol("mongoose#isNestedArray"),A=Object.freeze({});function $(t,e,n,o){s||(s=r(37).Embedded);var i,a,u="type";if(o&&o.typeKey&&(u=o.typeKey),this.schemaOptions=o,e){var c={};g.isPOJO(e)&&(e[u]?(delete(c=g.clone(e))[u],e=e[u]):e=h),null!=n&&null!=n.ref&&null==c.ref&&(c.ref=n.ref),e===Object&&(e=h);var l="string"==typeof e?e:g.getFunctionName(e),p=r(55),y=p.hasOwnProperty(l)?p[l]:e;if(this.casterConstructor=y,this.casterConstructor instanceof $&&(this.casterConstructor[S]=!0),"function"!=typeof y||y.$isArraySubdocument||y.$isSchemaMap)this.caster=y,this.caster instanceof s||(this.caster.path=t);else{var d=this.caster instanceof s?null:t;this.caster=new y(d,c)}this.$embeddedSchemaType=this.caster}if(this.$isMongooseArray=!0,f.call(this,t,n,"Array"),null!=this.defaultValue&&(i=this.defaultValue,a="function"==typeof i),!("defaultValue"in this)||void 0!==this.defaultValue){var _=function(){var t=[];return a?t=i.call(this):null!=i&&(t=t.concat(i)),t};_.$runBeforeSetters=!a,this.default(_)}}$.schemaName="Array",$.options={castNonArrays:!0},
|
|
708
|
+
/*!
|
|
709
|
+
* ignore
|
|
710
|
+
*/
|
|
711
|
+
$.defaultOptions={},$.set=f.set,
|
|
708
712
|
/*!
|
|
709
713
|
* Inherits from SchemaType.
|
|
710
714
|
*/
|
package/index.d.ts
CHANGED
|
@@ -1245,15 +1245,17 @@ declare module 'mongoose' {
|
|
|
1245
1245
|
virtualpath(name: string): VirtualType | null;
|
|
1246
1246
|
}
|
|
1247
1247
|
|
|
1248
|
-
type SchemaDefinitionWithBuiltInClass<T extends number | string | boolean | Function> = T extends number
|
|
1248
|
+
type SchemaDefinitionWithBuiltInClass<T extends number | string | boolean | NativeDate | Function> = T extends number
|
|
1249
1249
|
? (typeof Number | 'number' | 'Number' | typeof Schema.Types.Number)
|
|
1250
1250
|
: T extends string
|
|
1251
1251
|
? (typeof String | 'string' | 'String' | typeof Schema.Types.String)
|
|
1252
1252
|
: T extends boolean
|
|
1253
1253
|
? (typeof Boolean | 'boolean' | 'Boolean' | typeof Schema.Types.Boolean)
|
|
1254
|
+
: T extends NativeDate
|
|
1255
|
+
? (typeof NativeDate | 'date' | 'Date' | typeof Schema.Types.Date)
|
|
1254
1256
|
: (Function | string);
|
|
1255
1257
|
|
|
1256
|
-
type SchemaDefinitionProperty<T = undefined> = T extends string | number | Function
|
|
1258
|
+
type SchemaDefinitionProperty<T = undefined> = T extends string | number | boolean | NativeDate | Function
|
|
1257
1259
|
? (SchemaDefinitionWithBuiltInClass<T> | SchemaTypeOptions<T>) :
|
|
1258
1260
|
SchemaTypeOptions<T extends undefined ? any : T> |
|
|
1259
1261
|
typeof SchemaType |
|
|
@@ -1437,7 +1439,7 @@ declare module 'mongoose' {
|
|
|
1437
1439
|
|
|
1438
1440
|
export class SchemaTypeOptions<T> {
|
|
1439
1441
|
type?:
|
|
1440
|
-
T extends string | number | boolean | Function ? SchemaDefinitionWithBuiltInClass<T> :
|
|
1442
|
+
T extends string | number | boolean | NativeDate | Function ? SchemaDefinitionWithBuiltInClass<T> :
|
|
1441
1443
|
T extends Schema<any, any> ? T :
|
|
1442
1444
|
T extends object[] ? (Schema<Document<Unpacked<T>>>[] | ReadonlyArray<Schema<Document<Unpacked<T>>>> | Schema<Document & Unpacked<T>>[] | ReadonlyArray<Schema<Document & Unpacked<T>>>) :
|
|
1443
1445
|
T extends string[] ? (SchemaDefinitionWithBuiltInClass<string>[] | ReadonlyArray<SchemaDefinitionWithBuiltInClass<string>>) :
|
|
@@ -1674,6 +1676,9 @@ declare module 'mongoose' {
|
|
|
1674
1676
|
|
|
1675
1677
|
/** Additional options like `limit` and `lean`. */
|
|
1676
1678
|
options?: QueryOptions;
|
|
1679
|
+
|
|
1680
|
+
/** Additional options for plugins */
|
|
1681
|
+
[extra: string]: any;
|
|
1677
1682
|
}
|
|
1678
1683
|
|
|
1679
1684
|
class VirtualType {
|
package/lib/schema/array.js
CHANGED
|
@@ -146,6 +146,10 @@ SchemaArray.schemaName = 'Array';
|
|
|
146
146
|
|
|
147
147
|
SchemaArray.options = { castNonArrays: true };
|
|
148
148
|
|
|
149
|
+
/*!
|
|
150
|
+
* ignore
|
|
151
|
+
*/
|
|
152
|
+
|
|
149
153
|
SchemaArray.defaultOptions = {};
|
|
150
154
|
|
|
151
155
|
/**
|
|
@@ -163,7 +167,6 @@ SchemaArray.defaultOptions = {};
|
|
|
163
167
|
* @param {*} value - value for option
|
|
164
168
|
* @return {undefined}
|
|
165
169
|
* @function set
|
|
166
|
-
* @static
|
|
167
170
|
* @api public
|
|
168
171
|
*/
|
|
169
172
|
SchemaArray.set = SchemaType.set;
|
|
@@ -196,7 +199,6 @@ SchemaArray._checkRequired = SchemaType.prototype.checkRequired;
|
|
|
196
199
|
* @param {Function} fn
|
|
197
200
|
* @return {Function}
|
|
198
201
|
* @function checkRequired
|
|
199
|
-
* @static
|
|
200
202
|
* @api public
|
|
201
203
|
*/
|
|
202
204
|
|
package/lib/schema.js
CHANGED
|
@@ -2145,14 +2145,14 @@ module.exports = exports = Schema;
|
|
|
2145
2145
|
*
|
|
2146
2146
|
* ####Types:
|
|
2147
2147
|
*
|
|
2148
|
-
* - [String](#
|
|
2149
|
-
* - [Number](#
|
|
2150
|
-
* - [Boolean](#
|
|
2151
|
-
* - [Array](#
|
|
2152
|
-
* - [Buffer](#
|
|
2153
|
-
* - [Date](#
|
|
2154
|
-
* - [ObjectId](#
|
|
2155
|
-
* - [Mixed](#
|
|
2148
|
+
* - [String](/docs/schematypes.html#strings)
|
|
2149
|
+
* - [Number](/docs/schematypes.html#numbers)
|
|
2150
|
+
* - [Boolean](/docs/schematypes.html#booleans) | Bool
|
|
2151
|
+
* - [Array](/docs/schematypes.html#arrays)
|
|
2152
|
+
* - [Buffer](/docs/schematypes.html#buffers)
|
|
2153
|
+
* - [Date](/docs/schematypes.html#dates)
|
|
2154
|
+
* - [ObjectId](/docs/schematypes.html#objectids) | Oid
|
|
2155
|
+
* - [Mixed](/docs/schematypes.html#mixed)
|
|
2156
2156
|
*
|
|
2157
2157
|
* Using this exposed access to the `Mixed` SchemaType, we can use them in our schema.
|
|
2158
2158
|
*
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mongoose",
|
|
3
3
|
"description": "Mongoose MongoDB ODM",
|
|
4
|
-
"version": "5.13.
|
|
4
|
+
"version": "5.13.2",
|
|
5
5
|
"author": "Guillermo Rauch <guillermo@learnboost.com>",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"mongodb",
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
"license": "MIT",
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@types/mongodb": "^3.5.27",
|
|
23
|
+
"@types/node": "14.x || 15.x",
|
|
23
24
|
"bson": "^1.1.4",
|
|
24
25
|
"kareem": "2.3.2",
|
|
25
26
|
"mongodb": "3.6.8",
|