mongoose 5.11.18 → 5.12.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.
Files changed (34) hide show
  1. package/History.md +45 -0
  2. package/dist/browser.umd.js +52 -52
  3. package/index.d.ts +159 -105
  4. package/lib/connection.js +6 -9
  5. package/lib/document.js +116 -73
  6. package/lib/drivers/node-mongodb-native/connection.js +16 -4
  7. package/lib/helpers/cursor/eachAsync.js +26 -3
  8. package/lib/helpers/document/cleanModifiedSubpaths.js +1 -1
  9. package/lib/helpers/document/compile.js +7 -0
  10. package/lib/helpers/populate/assignVals.js +25 -11
  11. package/lib/helpers/populate/getSchemaTypes.js +2 -2
  12. package/lib/helpers/projection/isExclusive.js +4 -0
  13. package/lib/helpers/query/castUpdate.js +8 -1
  14. package/lib/helpers/query/getEmbeddedDiscriminatorPath.js +17 -1
  15. package/lib/helpers/query/selectPopulatedFields.js +22 -19
  16. package/lib/helpers/schema/cleanPositionalOperators.js +2 -2
  17. package/lib/helpers/timestamps/setupTimestamps.js +7 -0
  18. package/lib/helpers/update/castArrayFilters.js +2 -19
  19. package/lib/helpers/update/updatedPathsByArrayFilter.js +24 -0
  20. package/lib/index.js +16 -2
  21. package/lib/model.js +20 -16
  22. package/lib/plugins/removeSubdocs.js +2 -2
  23. package/lib/plugins/saveSubdocs.js +6 -6
  24. package/lib/plugins/sharding.js +1 -1
  25. package/lib/plugins/trackTransaction.js +2 -2
  26. package/lib/plugins/validateBeforeSave.js +2 -2
  27. package/lib/query.js +47 -25
  28. package/lib/schema/array.js +1 -1
  29. package/lib/schema/documentarray.js +10 -1
  30. package/lib/schema.js +7 -2
  31. package/lib/schematype.js +14 -1
  32. package/lib/types/core_array.js +2 -2
  33. package/lib/types/subdocument.js +3 -3
  34. package/package.json +3 -3
package/History.md CHANGED
@@ -1,3 +1,48 @@
1
+ 5.12.1 / 2021-03-18
2
+ ===================
3
+ * fix: update mongodb -> 3.6.5 to fix circular dependency warning #9900
4
+ * fix(document): make `toObject()` use child schema `flattenMaps` option by default #9995
5
+ * fix(ObjectId): make `isValidObjectId()` check that length 24 strings are hex chars only #10010 #9996 [IslandRhythms](https://github.com/IslandRhythms)
6
+ * fix(query): correctly cast embedded discriminator paths when discriminator key is specified in array filter #9977
7
+ * fix(schema): skip `populated()` check when calling `applyGetters()` with a POJO for mongoose-lean-getters support #9986
8
+ * fix(populate): support populating dotted subpath of a populated doc that has the same id as a populated doc #10005
9
+ * fix(index.d.ts): correct `this` for query helpers #10028 [francescov1](https://github.com/francescov1)
10
+ * fix(index.d.ts): avoid omitting function property keys in LeanDocuments, because TS can't accurately infer what's a function if using generic functions #9989
11
+ * fix(index.d.ts): correct type definition for `SchemaType#cast()` #10039 #9980
12
+ * fix(index.d.ts): make SchemaTypeOptions a class, add missing `SchemaType#OptionsConstructor` #10001
13
+ * fix(index.d.ts): support calling `findByIdAndUpdate()` with filter, update, callback params #9981
14
+
15
+ 5.12.0 / 2021-03-11
16
+ ===================
17
+ * feat(populate): add `transform` option that Mongoose will call on every populated doc #3775
18
+ * feat(query): make `Query#pre()` and `Query#post()` public #9784
19
+ * feat(document): add `Document#getPopulatedDocs()` to return an array of all populated documents in a document #9702 [IslandRhythms](https://github.com/IslandRhythms)
20
+ * feat(document): add `Document#getAllSubdocs()` to return an array of all single nested and array subdocuments #9764 [IslandRhythms](https://github.com/IslandRhythms)
21
+ * feat(schema): allow `schema` as a schema path name #8798 [IslandRhythms](https://github.com/IslandRhythms)
22
+ * feat(QueryCursor): Add batch processing for eachAsync #9902 [khaledosama999](https://github.com/khaledosama999)
23
+ * feat(connection): add `noListener` option to help with use cases where you're using `useDb()` on every request #9961
24
+ * feat(index): emit 'createConnection' event when user calls `mongoose.createConnection()` #9985
25
+ * feat(connection+index): emit 'model' and 'deleteModel' events on connections when creating and deleting models #9983
26
+ * feat(query): allow passing `explain` option to `Model.exists()` #8098 [IslandRhythms](https://github.com/IslandRhythms)
27
+
28
+ 5.11.20 / 2021-03-11
29
+ ====================
30
+ * fix(query+populate): avoid unnecessarily projecting in subpath when populating a path that uses an elemMatch projection #9973
31
+ * fix(connection): avoid `db` events deprecation warning with 'close' events #10004 #9930
32
+ * fix(index.d.ts): make `$pull` more permissive to allow dotted paths #9993
33
+
34
+ 5.11.19 / 2021-03-05
35
+ ====================
36
+ * fix(document): skip validating array elements that aren't modified when `validateModifiedOnly` is set #9963
37
+ * fix(timestamps): apply timestamps on `findOneAndReplace()` #9951
38
+ * fix(schema): correctly handle trailing array filters when looking up schema paths #9977
39
+ * fix(schema): load child class getter for virtuals instead of base class when using `loadClass()` #9975
40
+ * fix(index.d.ts): allow creating statics without passing generics to `Schema` constructor #9969
41
+ * fix(index.d.ts): add QueryHelpers generic to schema and model, make all query methods instead return QueryWithHelpers #9850
42
+ * fix(index.d.ts): support setting `type` to an array of schemas when using SchemaDefinitionType #9962
43
+ * fix(index.d.ts): add generic to plugin schema definition #9968 [emiljanitzek](https://github.com/emiljanitzek)
44
+ * docs: small typo fix #9964 [KrishnaMoorthy12](https://github.com/KrishnaMoorthy12)
45
+
1
46
  5.11.18 / 2021-02-23
2
47
  ====================
3
48
  * fix(connection): set connection state to `disconnected` if connecting string failed to parse #9921