mongoose 6.2.1 → 6.2.4
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/.eslintrc.json +5 -1
- package/.lgtm.yml +3 -0
- package/CHANGELOG.md +54 -0
- package/dist/browser.umd.js +156 -152
- package/index.js +5 -1
- package/lib/aggregate.js +22 -27
- package/lib/browserDocument.js +1 -1
- package/lib/cast/number.js +2 -3
- package/lib/cast.js +7 -4
- package/lib/connection.js +43 -21
- package/lib/cursor/AggregationCursor.js +12 -7
- package/lib/cursor/QueryCursor.js +11 -6
- package/lib/document.js +58 -72
- package/lib/drivers/node-mongodb-native/collection.js +12 -4
- package/lib/drivers/node-mongodb-native/connection.js +11 -0
- package/lib/error/cast.js +3 -2
- package/lib/helpers/clone.js +11 -2
- package/lib/helpers/cursor/eachAsync.js +18 -15
- package/lib/helpers/document/cleanModifiedSubpaths.js +1 -0
- package/lib/helpers/document/compile.js +7 -4
- package/lib/helpers/indexes/decorateDiscriminatorIndexOptions.js +14 -0
- package/lib/helpers/indexes/getRelatedIndexes.js +59 -0
- package/lib/helpers/isAsyncFunction.js +6 -7
- package/lib/helpers/populate/assignVals.js +4 -0
- package/lib/helpers/printJestWarning.js +2 -2
- package/lib/helpers/projection/applyProjection.js +77 -0
- package/lib/helpers/projection/hasIncludedChildren.js +36 -0
- package/lib/helpers/projection/isExclusive.js +5 -2
- package/lib/helpers/projection/isInclusive.js +5 -1
- package/lib/helpers/query/cast$expr.js +14 -19
- package/lib/helpers/query/hasDollarKeys.js +7 -3
- package/lib/helpers/query/isOperator.js +5 -2
- package/lib/helpers/schema/getIndexes.js +6 -2
- package/lib/index.js +14 -17
- package/lib/internal.js +9 -1
- package/lib/model.js +159 -153
- package/lib/options/SchemaTypeOptions.js +1 -1
- package/lib/plugins/trackTransaction.js +1 -1
- package/lib/query.js +159 -147
- package/lib/queryhelpers.js +8 -28
- package/lib/schema/SubdocumentPath.js +5 -4
- package/lib/schema/array.js +13 -6
- package/lib/schema/buffer.js +1 -1
- package/lib/schema/date.js +1 -1
- package/lib/schema/decimal128.js +1 -1
- package/lib/schema/documentarray.js +9 -7
- package/lib/schema/number.js +1 -1
- package/lib/schema/objectid.js +1 -1
- package/lib/schema/string.js +4 -4
- package/lib/schema.js +12 -8
- package/lib/schematype.js +12 -14
- package/lib/types/ArraySubdocument.js +1 -1
- package/lib/types/DocumentArray/index.js +1 -1
- package/lib/types/array/index.js +2 -2
- package/lib/types/array/methods/index.js +10 -11
- package/lib/types/buffer.js +3 -3
- package/lib/types/map.js +3 -4
- package/lib/utils.js +9 -3
- package/package.json +17 -21
- package/tsconfig.json +0 -2
- package/types/Connection.d.ts +212 -0
- package/types/Error.d.ts +129 -0
- package/types/PipelineStage.d.ts +272 -0
- package/types/index.d.ts +61 -602
- package/lib/types/array/ArrayWrapper.js +0 -981
|
@@ -162,7 +162,7 @@ Object.defineProperty(SchemaTypeOptions.prototype, 'unique', opts);
|
|
|
162
162
|
/**
|
|
163
163
|
* If [truthy](https://masteringjs.io/tutorials/fundamentals/truthy), Mongoose will
|
|
164
164
|
* disallow changes to this path once the document
|
|
165
|
-
* is saved to the database for the first time. Read more about [immutability in Mongoose here](
|
|
165
|
+
* is saved to the database for the first time. Read more about [immutability in Mongoose here](https://thecodebarbarian.com/whats-new-in-mongoose-5-6-immutable-properties.html).
|
|
166
166
|
*
|
|
167
167
|
* @api public
|
|
168
168
|
* @property immutable
|
|
@@ -47,7 +47,7 @@ function _getAtomics(doc, previous) {
|
|
|
47
47
|
for (const path of pathsToCheck) {
|
|
48
48
|
const val = doc.$__getValue(path);
|
|
49
49
|
if (val != null &&
|
|
50
|
-
val
|
|
50
|
+
Array.isArray(val) &&
|
|
51
51
|
utils.isMongooseDocumentArray(val) &&
|
|
52
52
|
val.length &&
|
|
53
53
|
val[arrayAtomicsSymbol] != null &&
|