sultanabubaker / SAST-npm-project

0 stars 0 forks source link

Update dependency mongoose to v5 - autoclosed #28

Closed dev-mend-for-github-com[bot] closed 2 years ago

dev-mend-for-github-com[bot] commented 2 years ago

This PR contains the following updates:

Package Type Update Change
mongoose (source) dependencies major 4.4.10 -> 5.11.7

By merging this PR, the issue #14 will be automatically resolved and closed:

Severity CVSS Score CVE
High High 9.8 CVE-2020-7610
High High 9.1 CVE-2019-17426
High High 7.5 CVE-2018-16490
Medium Medium 6.0 WS-2018-0224
Medium Medium 5.3 CVE-2020-35149

Release Notes

Automattic/mongoose ### [`v5.11.7`](https://togithub.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#​5117--2020-12-10) [Compare Source](https://togithub.com/Automattic/mongoose/compare/5.11.6...5.11.7) \=================== - fix(document): ensure calling `get()` with empty string returns undefined for mongoose-plugin-autoinc [#​9681](https://togithub.com/Automattic/mongoose/issues/9681) - fix(model): set `isNew` to false for documents that were successfully inserted by `insertMany` with `ordered = false` when an error occurred [#​9677](https://togithub.com/Automattic/mongoose/issues/9677) - fix(index.d.ts): add missing Aggregate#skip() & Aggregate#limit() [#​9692](https://togithub.com/Automattic/mongoose/issues/9692) [sahasayan](https://togithub.com/sahasayan) - fix(index.d.ts): make `Document#id` optional so types that use `id` can use `Model` [#​9684](https://togithub.com/Automattic/mongoose/issues/9684) ### [`v5.11.6`](https://togithub.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#​5116--2020-12-09) [Compare Source](https://togithub.com/Automattic/mongoose/compare/5.11.5...5.11.6) \=================== - fix(middleware): ensure sync errors in pre hooks always bubble up to the calling code [#​9659](https://togithub.com/Automattic/mongoose/issues/9659) - fix(index.d.ts): allow passing ObjectId properties as strings to `create()` and `findOneAndReplace()` [#​9676](https://togithub.com/Automattic/mongoose/issues/9676) - fix(index.d.ts): allow calling `mongoose.model()` and `Connection#model()` with model as generic param [#​9685](https://togithub.com/Automattic/mongoose/issues/9685) [#​9678](https://togithub.com/Automattic/mongoose/issues/9678) [sahasayan](https://togithub.com/sahasayan) - fix(index.d.ts): Fix return type of Model#aggregate() [#​9680](https://togithub.com/Automattic/mongoose/issues/9680) [orgads](https://togithub.com/orgads) - fix(index.d.ts): optional next() parameter for post middleware [#​9683](https://togithub.com/Automattic/mongoose/issues/9683) [isengartz](https://togithub.com/isengartz) - fix(index.d.ts): allow array of validators in SchemaTypeOptions [#​9686](https://togithub.com/Automattic/mongoose/issues/9686) [cjroebuck](https://togithub.com/cjroebuck) ### [`v5.11.5`](https://togithub.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#​5115--2020-12-07) [Compare Source](https://togithub.com/Automattic/mongoose/compare/5.11.4...5.11.5) \=================== - fix(map): support `null` in maps of subdocs [#​9628](https://togithub.com/Automattic/mongoose/issues/9628) - fix(index.d.ts): support object syntax for `validate` [#​9667](https://togithub.com/Automattic/mongoose/issues/9667) - fix(index.d.ts): Allow number for Schema expires [#​9670](https://togithub.com/Automattic/mongoose/issues/9670) [alecgibson](https://togithub.com/alecgibson) - fix(index.d.ts): allow definining arbitrary properties on SchemaTypeOpts for plugins like mongoose-autopopulate [#​9669](https://togithub.com/Automattic/mongoose/issues/9669) - fix(index.d.ts): add mongoose.models [#​9661](https://togithub.com/Automattic/mongoose/issues/9661) [#​9660](https://togithub.com/Automattic/mongoose/issues/9660) [AbdelrahmanHafez](https://togithub.com/AbdelrahmanHafez) - fix(index.d.ts): allow the next() argument to be optional [#​9665](https://togithub.com/Automattic/mongoose/issues/9665) [#​9664](https://togithub.com/Automattic/mongoose/issues/9664) [sahasayan](https://togithub.com/sahasayan) - fix(index.d.ts): add missing `VirtualType#applyGetters()` and `applySetters()`, `Schema#virtuals`, `Schema#childSchemas`, `Query#_mongooseOptions` [#​9658](https://togithub.com/Automattic/mongoose/issues/9658) - fix(index.d.ts): add `id` to LeanDocuments in case it is defined in the user's schema [#​9657](https://togithub.com/Automattic/mongoose/issues/9657) - fix(index.d.ts): add missing types for hook functions [#​9653](https://togithub.com/Automattic/mongoose/issues/9653) - fix(index.d.ts): improve support for strict null checks with `upsert` and `orFail()` [#​9654](https://togithub.com/Automattic/mongoose/issues/9654) - fix(index.d.ts): make return values for `insertMany()` more consistent [#​9662](https://togithub.com/Automattic/mongoose/issues/9662) - fix(index.d.ts): Change options in Connection#collection() to be optional [#​9663](https://togithub.com/Automattic/mongoose/issues/9663) [orgads](https://togithub.com/orgads) - fix(index.d.ts): add the missing generic declaration for Schema [#​9655](https://togithub.com/Automattic/mongoose/issues/9655) [sahasayan](https://togithub.com/sahasayan) - fix(index.d.ts): add missing `SchemaTypeOpts` and `ConnectionOptions` aliases for backwards compat - docs(populate): remove `sort()` from `limit` example to avoid potential confusion [#​9584](https://togithub.com/Automattic/mongoose/issues/9584) - docs(compatibility): add MongoDB server 4.4 version compatibility [#​9641](https://togithub.com/Automattic/mongoose/issues/9641) ### [`v5.11.4`](https://togithub.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#​5114--2020-12-04) [Compare Source](https://togithub.com/Automattic/mongoose/compare/5.11.3...5.11.4) \=================== - fix(index.d.ts): add `Document#__v` so documents have a Version by default [#​9652](https://togithub.com/Automattic/mongoose/issues/9652) [sahasayan](https://togithub.com/sahasayan) - fix(index.d.ts): add missing `session` option to `SaveOptions` [#​9642](https://togithub.com/Automattic/mongoose/issues/9642) - fix(index.d.ts): add `Schema#paths`, `Schema#static(obj)`, `Embedded#schema`, `DocumentArray#schema`, make Schema inherit from EventEmitter [#​9650](https://togithub.com/Automattic/mongoose/issues/9650) - fix(index.d.ts): order when cb is optional in method [#​9647](https://togithub.com/Automattic/mongoose/issues/9647) [CatsMiaow](https://togithub.com/CatsMiaow) - fix(index.d.ts): use DocumentDefinition for `FilterQuery` [#​9649](https://togithub.com/Automattic/mongoose/issues/9649) - fix(index.d.ts): correct callback result types for `find()`, `findOne()`, `findById()` [#​9648](https://togithub.com/Automattic/mongoose/issues/9648) - fix(index.d.ts): remove `Document#parent()` method because it conflicts with existing user code [#​9645](https://togithub.com/Automattic/mongoose/issues/9645) - fix(index.d.ts): add missing `Connection#db` property [#​9643](https://togithub.com/Automattic/mongoose/issues/9643) - test(typescript): add `tsconfig.json` file for intellisense [#​9611](https://togithub.com/Automattic/mongoose/issues/9611) [alecgibson](https://togithub.com/alecgibson) ### [`v5.11.3`](https://togithub.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#​5113--2020-12-03) [Compare Source](https://togithub.com/Automattic/mongoose/compare/5.11.2...5.11.3) \=================== - fix(index.d.ts): make Mongoose collection inherit MongoDB collection [#​9637](https://togithub.com/Automattic/mongoose/issues/9637) [#​9630](https://togithub.com/Automattic/mongoose/issues/9630) [AbdelrahmanHafez](https://togithub.com/AbdelrahmanHafez) - fix(index.d.ts): add `Document#_id` so documents have an id by default [#​9632](https://togithub.com/Automattic/mongoose/issues/9632) - fix(index.d.ts): allow inline schema definitions for nested properties [#​9639](https://togithub.com/Automattic/mongoose/issues/9639) [Green-Cat](https://togithub.com/Green-Cat) - fix(index.d.ts): add support for missing error message definitions [#​9638](https://togithub.com/Automattic/mongoose/issues/9638) [SaifAlsabe](https://togithub.com/SaifAlsabe) - fix(schema+discriminator): support defining recursive embedded discriminators by passing document array schematype to discriminator [#​9600](https://togithub.com/Automattic/mongoose/issues/9600) - fix(index.d.ts): make it possible to use `LeanDocument` with arrays [#​9620](https://togithub.com/Automattic/mongoose/issues/9620) - fix(index.d.ts): add `ModelUpdateOptions` as alias for `QueryOptions` for backwards compat [#​9637](https://togithub.com/Automattic/mongoose/issues/9637) ### [`v5.11.2`](https://togithub.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#​51120--2021-03-11) [Compare Source](https://togithub.com/Automattic/mongoose/compare/5.11.1...5.11.2) \==================== - fix(query+populate): avoid unnecessarily projecting in subpath when populating a path that uses an elemMatch projection [#​9973](https://togithub.com/Automattic/mongoose/issues/9973) - fix(connection): avoid `db` events deprecation warning with 'close' events [#​10004](https://togithub.com/Automattic/mongoose/issues/10004) [#​9930](https://togithub.com/Automattic/mongoose/issues/9930) - fix(index.d.ts): make `$pull` more permissive to allow dotted paths [#​9993](https://togithub.com/Automattic/mongoose/issues/9993) ### [`v5.11.1`](https://togithub.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#​51119--2021-03-05) [Compare Source](https://togithub.com/Automattic/mongoose/compare/5.11.0...5.11.1) \==================== - fix(document): skip validating array elements that aren't modified when `validateModifiedOnly` is set [#​9963](https://togithub.com/Automattic/mongoose/issues/9963) - fix(timestamps): apply timestamps on `findOneAndReplace()` [#​9951](https://togithub.com/Automattic/mongoose/issues/9951) - fix(schema): correctly handle trailing array filters when looking up schema paths [#​9977](https://togithub.com/Automattic/mongoose/issues/9977) - fix(schema): load child class getter for virtuals instead of base class when using `loadClass()` [#​9975](https://togithub.com/Automattic/mongoose/issues/9975) - fix(index.d.ts): allow creating statics without passing generics to `Schema` constructor [#​9969](https://togithub.com/Automattic/mongoose/issues/9969) - fix(index.d.ts): add QueryHelpers generic to schema and model, make all query methods instead return QueryWithHelpers [#​9850](https://togithub.com/Automattic/mongoose/issues/9850) - fix(index.d.ts): support setting `type` to an array of schemas when using SchemaDefinitionType [#​9962](https://togithub.com/Automattic/mongoose/issues/9962) - fix(index.d.ts): add generic to plugin schema definition [#​9968](https://togithub.com/Automattic/mongoose/issues/9968) [emiljanitzek](https://togithub.com/emiljanitzek) - docs: small typo fix [#​9964](https://togithub.com/Automattic/mongoose/issues/9964) [KrishnaMoorthy12](https://togithub.com/KrishnaMoorthy12) ### [`v5.11.0`](https://togithub.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#​5110--2020-11-30) [Compare Source](https://togithub.com/Automattic/mongoose/compare/5.10.19...5.11.0) \=================== - feat: add official TypeScript definitions `index.d.ts` file [#​8108](https://togithub.com/Automattic/mongoose/issues/8108) - feat(connection): add bufferTimeoutMS option that configures how long Mongoose will allow commands to buffer [#​9469](https://togithub.com/Automattic/mongoose/issues/9469) - feat(populate): support populate virtuals with `localField` and `foreignField` as arrays [#​6608](https://togithub.com/Automattic/mongoose/issues/6608) - feat(populate+virtual): feat: support getters on populate virtuals, including `get` option for `Schema#virtual()` [#​9343](https://togithub.com/Automattic/mongoose/issues/9343) - feat(populate+schema): add support for `populate` schematype option that sets default populate options [#​6029](https://togithub.com/Automattic/mongoose/issues/6029) - feat(QueryCursor): execute post find hooks for each doc in query cursor [#​9345](https://togithub.com/Automattic/mongoose/issues/9345) - feat(schema): support overwriting cast logic for individual schematype instances [#​8407](https://togithub.com/Automattic/mongoose/issues/8407) - feat(QueryCursor): make cursor `populate()` in batch when using `batchSize` [#​9366](https://togithub.com/Automattic/mongoose/issues/9366) [biomorgoth](https://togithub.com/biomorgoth) - chore: remove changelog from published bundle [#​9404](https://togithub.com/Automattic/mongoose/issues/9404) - feat(model+mongoose): add `overwriteModels` option to bypass `OverwriteModelError` globally [#​9406](https://togithub.com/Automattic/mongoose/issues/9406) - feat(model+query): allow defining middleware for all query methods or all document methods, but not other middleware types [#​9190](https://togithub.com/Automattic/mongoose/issues/9190) - feat(document+model): make change tracking skip saving if new value matches last saved value [#​9396](https://togithub.com/Automattic/mongoose/issues/9396) - perf(utils): major speedup for `deepEqual()` on documents and arrays [#​9396](https://togithub.com/Automattic/mongoose/issues/9396) - feat(schema): support passing a TypeScript enum to `enum` validator in schema [#​9547](https://togithub.com/Automattic/mongoose/issues/9547) [#​9546](https://togithub.com/Automattic/mongoose/issues/9546) [AbdelrahmanHafez](https://togithub.com/AbdelrahmanHafez) - feat(debug): [#​8963](https://togithub.com/Automattic/mongoose/issues/8963) `shell` option for date format (ISODate) [#​9532](https://togithub.com/Automattic/mongoose/issues/9532) [FlameFractal](https://togithub.com/FlameFractal) - feat(document): support square bracket indexing for `get()`, `set()` [#​9375](https://togithub.com/Automattic/mongoose/issues/9375) - feat(document): support array and space-delimited syntax for `Document#$isValid()`, `isDirectSelected()`, `isSelected()`, `$isDefault()` [#​9474](https://togithub.com/Automattic/mongoose/issues/9474) - feat(string): make `minLength` and `maxLength` behave the same as `minlength` and `maxlength` [#​8777](https://togithub.com/Automattic/mongoose/issues/8777) [m-weeks](https://togithub.com/m-weeks) - feat(document): add `$parent()` as an alias for `parent()` for documents and subdocuments to avoid path name conflicts [#​9455](https://togithub.com/Automattic/mongoose/issues/9455) ### [`v5.10.19`](https://togithub.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#​51019--2020-11-30) [Compare Source](https://togithub.com/Automattic/mongoose/compare/5.10.18...5.10.19) \==================== - fix(query): support passing an array to `$type` in query filters [#​9577](https://togithub.com/Automattic/mongoose/issues/9577) - perf(schema): avoid creating unnecessary objects when casting to array [#​9588](https://togithub.com/Automattic/mongoose/issues/9588) - docs: make example gender neutral [#​9601](https://togithub.com/Automattic/mongoose/issues/9601) [rehatkathuria](https://togithub.com/rehatkathuria) ### [`v5.10.18`](https://togithub.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#​51018--2020-11-29) [Compare Source](https://togithub.com/Automattic/mongoose/compare/5.10.17...5.10.18) \==================== - fix(connection): connect and disconnect can be used destructured [#​9598](https://togithub.com/Automattic/mongoose/issues/9598) [#​9597](https://togithub.com/Automattic/mongoose/issues/9597) [AbdelrahmanHafez](https://togithub.com/AbdelrahmanHafez) ### [`v5.10.17`](https://togithub.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#​51017--2020-11-27) [Compare Source](https://togithub.com/Automattic/mongoose/compare/5.10.16...5.10.17) \==================== - fix(document): allow setting fields after an undefined field [#​9587](https://togithub.com/Automattic/mongoose/issues/9587) [AbdelrahmanHafez](https://togithub.com/AbdelrahmanHafez) ### [`v5.10.16`](https://togithub.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#​51016--2020-11-25) [Compare Source](https://togithub.com/Automattic/mongoose/compare/5.10.15...5.10.16) \==================== - fix(connection): copy config options from connection rather than base connection when calling `useDb()` [#​9569](https://togithub.com/Automattic/mongoose/issues/9569) - fix(schema): support `of` for array type definitions to be consistent with maps [#​9564](https://togithub.com/Automattic/mongoose/issues/9564) - docs(dates): fix broken example reference [#​9557](https://togithub.com/Automattic/mongoose/issues/9557) [kertof](https://togithub.com/kertof) - docs(virtualtype): remove unintentional h2 tag re: [tj/dox#​60](https://togithub.com/tj/dox/issues/60) [#​9568](https://togithub.com/Automattic/mongoose/issues/9568) ### [`v5.10.15`](https://togithub.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#​51015--2020-11-16) [Compare Source](https://togithub.com/Automattic/mongoose/compare/5.10.14...5.10.15) \==================== - fix(array): make sure `Array#toObject()` returns a vanilla JavaScript array in Node.js 6+ [#​9540](https://togithub.com/Automattic/mongoose/issues/9540) - fix(connection): make `disconnect()` stop Mongoose if it is trying to reconnect [#​9531](https://togithub.com/Automattic/mongoose/issues/9531) - fix: ensure `Document#overwrite()` correctly overwrites maps [#​9549](https://togithub.com/Automattic/mongoose/issues/9549) - fix(document): make transform work with nested paths [#​9544](https://togithub.com/Automattic/mongoose/issues/9544) [#​9543](https://togithub.com/Automattic/mongoose/issues/9543) [jonathan-wilkinson](https://togithub.com/jonathan-wilkinson) - fix(query): maxTimeMS in count, countDocuments, distinct [#​9552](https://togithub.com/Automattic/mongoose/issues/9552) [FlameFractal](https://togithub.com/FlameFractal) - fix(schema): remove warning re: `increment` as a schema path name [#​9538](https://togithub.com/Automattic/mongoose/issues/9538) - fix(model): automatically set `partialFilterExpression` for indexes in discriminator schemas [#​9542](https://togithub.com/Automattic/mongoose/issues/9542) ### [`v5.10.14`](https://togithub.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#​51014--2020-11-12) [Compare Source](https://togithub.com/Automattic/mongoose/compare/5.10.13...5.10.14) \==================== - fix(update): handle casting immutable object properties with `$setOnInsert` [#​9537](https://togithub.com/Automattic/mongoose/issues/9537) - fix(discriminator): overwrite instead of merge if discriminator schema specifies a path is single nested but base schema has path as doc array [#​9534](https://togithub.com/Automattic/mongoose/issues/9534) - docs(middleware): clarify that you need to set both `document` and `query` on `remove` hooks to get just document middleware [#​9530](https://togithub.com/Automattic/mongoose/issues/9530) [mustafaKamal-fe](https://togithub.com/mustafaKamal-fe) - docs(CONTRIBUTING): remove mmapv1 recommendation and clean up a few other details [#​9529](https://togithub.com/Automattic/mongoose/issues/9529) - refactor: remove duplicate function definition [#​9527](https://togithub.com/Automattic/mongoose/issues/9527) [ksullivan](https://togithub.com/ksullivan) ### [`v5.10.13`](https://togithub.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#​51013--2020-11-06) [Compare Source](https://togithub.com/Automattic/mongoose/compare/5.10.12...5.10.13) \==================== - fix: upgrade mongodb driver -> 3.6.3 for Lambda cold start fixes [#​9521](https://togithub.com/Automattic/mongoose/issues/9521) [#​9179](https://togithub.com/Automattic/mongoose/issues/9179) [AbdelrahmanHafez](https://togithub.com/AbdelrahmanHafez) - fix(document): correctly handle setting props to other nested props [#​9519](https://togithub.com/Automattic/mongoose/issues/9519) ### [`v5.10.12`](https://togithub.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#​51012--2020-11-04) [Compare Source](https://togithub.com/Automattic/mongoose/compare/5.10.11...5.10.12) \==================== - fix(connection): catch and report sync errors in connection wrappers like `startSession()` [#​9515](https://togithub.com/Automattic/mongoose/issues/9515) - fix(document): ignore getters when diffing values for change tracking [#​9501](https://togithub.com/Automattic/mongoose/issues/9501) - fix(connection): avoid executing promise handler unless it's a function [#​9507](https://togithub.com/Automattic/mongoose/issues/9507) [AbdelrahmanHafez](https://togithub.com/AbdelrahmanHafez) - fix(error): throw more helpful error when connecting to a non-SSL MongoDB server with SSL enabled [#​9511](https://togithub.com/Automattic/mongoose/issues/9511) - docs(model+query): clarify that `deleteOne` and `deleteMany` trigger middleware [#​9504](https://togithub.com/Automattic/mongoose/issues/9504) - docs(ssl): add note about `ssl` defaulting to `true` for srv connection strings [#​9511](https://togithub.com/Automattic/mongoose/issues/9511) ### [`v5.10.11`](https://togithub.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#​51011--2020-10-26) [Compare Source](https://togithub.com/Automattic/mongoose/compare/5.10.10...5.10.11) \==================== - fix(connection): when calling `mongoose.connect()` multiple times in parallel, make 2nd call wait for connection before resolving [#​9476](https://togithub.com/Automattic/mongoose/issues/9476) - fix(map): make `save()` persist `Map#clear()` [#​9493](https://togithub.com/Automattic/mongoose/issues/9493) - fix(document): avoid overwriting array subdocument when setting dotted path that isn't selected [#​9427](https://togithub.com/Automattic/mongoose/issues/9427) - fix(connection): don't throw Atlas error if server discovery doesn't find any servers [#​9470](https://togithub.com/Automattic/mongoose/issues/9470) - docs: update options for Model.findOneAndUpdate [#​9499](https://togithub.com/Automattic/mongoose/issues/9499) [radamson](https://togithub.com/radamson) ### [`v5.10.10`](https://togithub.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#​51010--2020-10-23) [Compare Source](https://togithub.com/Automattic/mongoose/compare/5.10.9...5.10.10) \==================== - fix(schema): handle merging schemas from separate Mongoose module instances when schema has a virtual [#​9471](https://togithub.com/Automattic/mongoose/issues/9471) - fix(connection): make connection.then(...) resolve to a connection instance [#​9497](https://togithub.com/Automattic/mongoose/issues/9497) [AbdelrahmanHafez](https://togithub.com/AbdelrahmanHafez) - fix(aggregate): when using $search with discriminators, add `$match` as the 2nd stage in pipeline rather than 1st [#​9487](https://togithub.com/Automattic/mongoose/issues/9487) - fix(query): cast $nor within $elemMatch [#​9479](https://togithub.com/Automattic/mongoose/issues/9479) - docs(connection): add note about 'error' event versus 'disconnected' event [#​9488](https://togithub.com/Automattic/mongoose/issues/9488) [tareqdayya](https://togithub.com/tareqdayya) ### [`v5.10.9`](https://togithub.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#​5109--2020-10-09) [Compare Source](https://togithub.com/Automattic/mongoose/compare/5.10.8...5.10.9) \=================== - fix(update): strip out unused array filters to avoid "filter was not used in the update" error [#​9468](https://togithub.com/Automattic/mongoose/issues/9468) - fix(mongoose): allow setting `autoCreate` as a global option to be consistent with `autoIndex` [#​9466](https://togithub.com/Automattic/mongoose/issues/9466) ### [`v5.10.8`](https://togithub.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#​5108--2020-10-05) [Compare Source](https://togithub.com/Automattic/mongoose/compare/5.10.7...5.10.8) \=================== - fix(schema): handle setting nested paths underneath single nested subdocs [#​9459](https://togithub.com/Automattic/mongoose/issues/9459) - fix(schema+index): allow calling `mongoose.model()` with schema from a different Mongoose module instance [#​9449](https://togithub.com/Automattic/mongoose/issues/9449) - fix(transaction): fix saving new documents w/ arrays in transactions [#​9457](https://togithub.com/Automattic/mongoose/issues/9457) [PenguinToast](https://togithub.com/PenguinToast) - fix(document): track `reason` on cast errors that occur while init-ing a document [#​9448](https://togithub.com/Automattic/mongoose/issues/9448) - fix(model): make `createCollection()` not throw error when collection already exists to be consistent with v5.9 [#​9447](https://togithub.com/Automattic/mongoose/issues/9447) - docs(connections): add SSL connections docs [#​9443](https://togithub.com/Automattic/mongoose/issues/9443) - docs(query_casting): fix typo [#​9458](https://togithub.com/Automattic/mongoose/issues/9458) [craig-davis](https://togithub.com/craig-davis) ### [`v5.10.7`](https://togithub.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#​5107--2020-09-24) [Compare Source](https://togithub.com/Automattic/mongoose/compare/5.10.6...5.10.7) \=================== - fix(schema): set correct path and schema on nested primitive arrays [#​9429](https://togithub.com/Automattic/mongoose/issues/9429) - fix(document): pass document to required validator so `required` can use arrow functions [#​9435](https://togithub.com/Automattic/mongoose/issues/9435) [AbdelrahmanHafez](https://togithub.com/AbdelrahmanHafez) - fix(document): handle required when schema has property named `isSelected` [#​9438](https://togithub.com/Automattic/mongoose/issues/9438) - fix(timestamps): allow using timestamps when schema has a property named 'set' [#​9428](https://togithub.com/Automattic/mongoose/issues/9428) - fix(schema): make `Schema#clone()` use parent Mongoose instance's Schema constructor [#​9426](https://togithub.com/Automattic/mongoose/issues/9426) ### [`v5.10.6`](https://togithub.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#​5106--2020-09-18) [Compare Source](https://togithub.com/Automattic/mongoose/compare/5.10.5...5.10.6) \=================== - fix(populate): handle `options.perDocumentLimit` option same as `perDocumentLimit` when calling `populate()` [#​9418](https://togithub.com/Automattic/mongoose/issues/9418) - fix(document): invalidate path if default function throws an error [#​9408](https://togithub.com/Automattic/mongoose/issues/9408) - fix: ensure subdocument defaults run after initial values are set when initing [#​9408](https://togithub.com/Automattic/mongoose/issues/9408) - docs(faq+queries): add more detail about duplicate queries, including an faq entry [#​9386](https://togithub.com/Automattic/mongoose/issues/9386) - docs: replace var with let and const in docs and test files [#​9414](https://togithub.com/Automattic/mongoose/issues/9414) [jmadankumar](https://togithub.com/jmadankumar) - docs(model+query): document using array of strings as projection [#​9413](https://togithub.com/Automattic/mongoose/issues/9413) - docs(middleware): add missing backtick [#​9425](https://togithub.com/Automattic/mongoose/issues/9425) [tphobe9312](https://togithub.com/tphobe9312) ### [`v5.10.5`](https://togithub.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#​5105--2020-09-11) [Compare Source](https://togithub.com/Automattic/mongoose/compare/5.10.4...5.10.5) \=================== - fix: bump mongodb -> 3.6.2 [#​9411](https://togithub.com/Automattic/mongoose/issues/9411) [AbdelrahmanHafez](https://togithub.com/AbdelrahmanHafez) - fix(query+aggregate+cursor): support async iteration over a cursor instance as opposed to a Query or Aggregate instance [#​9403](https://togithub.com/Automattic/mongoose/issues/9403) - fix(document): respect child schema `minimize` if `toObject()` is called without an explicit `minimize` [#​9405](https://togithub.com/Automattic/mongoose/issues/9405) - docs(guide): use const instead of var [#​9394](https://togithub.com/Automattic/mongoose/issues/9394) [nainardev](https://togithub.com/nainardev) - docs(query): link to lean, findOneAndUpdate, query casting tutorials from query docs [#​9410](https://togithub.com/Automattic/mongoose/issues/9410) ### [`v5.10.4`](https://togithub.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#​5104--2020-09-09) [Compare Source](https://togithub.com/Automattic/mongoose/compare/5.10.3...5.10.4) \=================== - fix(document): allow setting nested path to instance of model [#​9392](https://togithub.com/Automattic/mongoose/issues/9392) - fix: handle `findOneAndRemove()` with `orFail()` [#​9381](https://togithub.com/Automattic/mongoose/issues/9381) - fix(schema): support setting `_id` option to `false` after instantiating schema [#​9390](https://togithub.com/Automattic/mongoose/issues/9390) - docs(document): fix formatting on `getChanges()` [#​9376](https://togithub.com/Automattic/mongoose/issues/9376) ### [`v5.10.3`](https://togithub.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#​5103--2020-09-03) [Compare Source](https://togithub.com/Automattic/mongoose/compare/5.10.2...5.10.3) \=================== - fix: upgrade mongodb -> 3.6.1 [#​9380](https://togithub.com/Automattic/mongoose/issues/9380) [lamhieu-vk](https://togithub.com/lamhieu-vk) - fix(populate): allow populating paths underneath subdocument maps [#​9359](https://togithub.com/Automattic/mongoose/issues/9359) - fix(update): handle casting map paths when map is underneath a single nested subdoc [#​9298](https://togithub.com/Automattic/mongoose/issues/9298) - fix(discriminator): avoid removing nested path if both base and discriminator schema have the same nested path [#​9362](https://togithub.com/Automattic/mongoose/issues/9362) - fix(schema): support `Schema#add()` with schematype instances with different paths [#​9370](https://togithub.com/Automattic/mongoose/issues/9370) - docs(api): fix typo in `Query#get()` example [#​9372](https://togithub.com/Automattic/mongoose/issues/9372) [elainewlin](https://togithub.com/elainewlin) ### [`v5.10.2`](https://togithub.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#​5102--2020-08-28) [Compare Source](https://togithub.com/Automattic/mongoose/compare/5.10.1...5.10.2) \=================== - fix(model): avoid uncaught error if `insertMany()` fails due to server selection error [#​9355](https://togithub.com/Automattic/mongoose/issues/9355) - fix(aggregate): automatically convert accumulator function options to strings [#​9364](https://togithub.com/Automattic/mongoose/issues/9364) - fix(document): handle `pull()` on a document array when `_id` is an alias [#​9319](https://togithub.com/Automattic/mongoose/issues/9319) - fix(queryhelpers): avoid path collision error when projecting in discriminator key with `.$` [#​9361](https://togithub.com/Automattic/mongoose/issues/9361) - fix: fix typo in error message thrown by unimplemented createIndex [#​9367](https://togithub.com/Automattic/mongoose/issues/9367) [timhaley94](https://togithub.com/timhaley94) - docs(plugins): note that plugins should be applied before you call `mongoose.model()` [#​7723](https://togithub.com/Automattic/mongoose/issues/7723) ### [`v5.10.1`](https://togithub.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#​51019--2020-11-30) [Compare Source](https://togithub.com/Automattic/mongoose/compare/5.10.0...5.10.1) \==================== - fix(query): support passing an array to `$type` in query filters [#​9577](https://togithub.com/Automattic/mongoose/issues/9577) - perf(schema): avoid creating unnecessary objects when casting to array [#​9588](https://togithub.com/Automattic/mongoose/issues/9588) - docs: make example gender neutral [#​9601](https://togithub.com/Automattic/mongoose/issues/9601) [rehatkathuria](https://togithub.com/rehatkathuria) ### [`v5.10.0`](https://togithub.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#​5100--2020-08-14) [Compare Source](https://togithub.com/Automattic/mongoose/compare/5.9.29...5.10.0) \=================== - feat: upgrade to MongoDB driver 3.6 for full MongoDB 4.4 support - feat(connection): add `Connection#transaction()` helper that handles resetting Mongoose document state if the transaction fails [#​8380](https://togithub.com/Automattic/mongoose/issues/8380) - feat(connection): make transaction() helper reset array atomics after failed transaction - feat(schema+model): add `optimisticConcurrency` option to use OCC for `save()` [#​9001](https://togithub.com/Automattic/mongoose/issues/9001) [#​5424](https://togithub.com/Automattic/mongoose/issues/5424) - feat(aggregate): add `Aggregate#search()` for Atlas Text Search [#​9115](https://togithub.com/Automattic/mongoose/issues/9115) - feat(mongoose): add support for setting `setDefaultsOnInsert` as a global option [#​9036](https://togithub.com/Automattic/mongoose/issues/9036) [AbdelrahmanHafez](https://togithub.com/AbdelrahmanHafez) - feat(mongoose): add support for setting `returnOriginal` as a global option [#​9189](https://togithub.com/Automattic/mongoose/issues/9189) [#​9183](https://togithub.com/Automattic/mongoose/issues/9183) [AbdelrahmanHafez](https://togithub.com/AbdelrahmanHafez) - feat(mongoose): allow global option mongoose.set('strictQuery', true) [#​9016](https://togithub.com/Automattic/mongoose/issues/9016) [AbdelrahmanHafez](https://togithub.com/AbdelrahmanHafez) - feat(document): add Document#getChanges [#​9097](https://togithub.com/Automattic/mongoose/issues/9097) [AbdelrahmanHafez](https://togithub.com/AbdelrahmanHafez) - feat(document): support `defaults` option to disable adding defaults to a single document [#​8271](https://togithub.com/Automattic/mongoose/issues/8271) - feat(SingleNestedPath+DocumentArray): add static `set()` function for global options, support setting `_id` globally [#​8883](https://togithub.com/Automattic/mongoose/issues/8883) - feat(query): handle casting `$or` when each clause contains a different discriminator key [#​9018](https://togithub.com/Automattic/mongoose/issues/9018) - feat(query): add overwriteDiscriminatorKey option that allows changing the discriminator key in `findOneAndUpdate()`, `updateOne()`, etc. [#​6087](https://togithub.com/Automattic/mongoose/issues/6087) - fix(connection): make calling `mongoose.connect()` while already connected a no-op [#​9203](https://togithub.com/Automattic/mongoose/issues/9203) - feat(connection): add `getClient()` and `setClient()` function for interacting with a connection's underlying MongoClient instance [#​9164](https://togithub.com/Automattic/mongoose/issues/9164) - feat(document+populate): add `parent()` function that allows you to get the parent document for populated docs [#​8092](https://togithub.com/Automattic/mongoose/issues/8092) - feat(document): add `useProjection` option to `toObject()` and `toJSON()` for hiding deselected fields on newly created documents [#​9118](https://togithub.com/Automattic/mongoose/issues/9118) ### [`v5.9.29`](https://togithub.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#​5929--2020-08-13) [Compare Source](https://togithub.com/Automattic/mongoose/compare/5.9.28...5.9.29) \=================== - fix(document): support setting nested path to itself when it has nested subpaths [#​9313](https://togithub.com/Automattic/mongoose/issues/9313) - fix(model): make `syncIndexes()` report error if it can't create an index [#​9303](https://togithub.com/Automattic/mongoose/issues/9303) - fix: handle auth error when Atlas username is incorrect [#​9300](https://togithub.com/Automattic/mongoose/issues/9300) ### [`v5.9.28`](https://togithub.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#​5928--2020-08-07) [Compare Source](https://togithub.com/Automattic/mongoose/compare/5.9.27...5.9.28) \=================== - fix(connection): consistently stop buffering when "reconnected" is emitted [#​9295](https://togithub.com/Automattic/mongoose/issues/9295) - fix(error): ensure `name` and `message` show up on individual ValidatorErrors when calling JSON.stringify() on a ValidationError [#​9296](https://togithub.com/Automattic/mongoose/issues/9296) - fix(document): keeps manually populated paths when setting a nested path to itself [#​9293](https://togithub.com/Automattic/mongoose/issues/9293) - fix(document): allow saving after setting document array to itself [#​9266](https://togithub.com/Automattic/mongoose/issues/9266) - fix(schema): handle `match` schema validator with `/g` flag [#​9287](https://togithub.com/Automattic/mongoose/issues/9287) - docs(guide): refactor transactions examples to async/await [#​9204](https://togithub.com/Automattic/mongoose/issues/9204) ### [`v5.9.27`](https://togithub.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#​5927--2020-07-31) [Compare Source](https://togithub.com/Automattic/mongoose/compare/5.9.26...5.9.27) \=================== - fix: upgrade mongodb driver -> 3.5.10 [AbdelrahmanHafez](https://togithub.com/AbdelrahmanHafez) - docs(transactions): make transactions docs use async/await for readability [#​9204](https://togithub.com/Automattic/mongoose/issues/9204) ### [`v5.9.26`](https://togithub.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#​5926--2020-07-27) [Compare Source](https://togithub.com/Automattic/mongoose/compare/5.9.25...5.9.26) \=================== - fix(document): allow unsetting boolean field by setting the field to `undefined` [#​9275](https://togithub.com/Automattic/mongoose/issues/9275) - fix(document): throw error when overwriting a single nested subdoc changes an immutable path within the subdoc [#​9281](https://togithub.com/Automattic/mongoose/issues/9281) - fix(timestamps): apply timestamps to `bulkWrite()` updates when not using `$set` [#​9268](https://togithub.com/Automattic/mongoose/issues/9268) - fix(browser): upgrade babel to v7 to work around an issue with `extends Error` [#​9273](https://togithub.com/Automattic/mongoose/issues/9273) - fix: make subdocument's `invalidate()` methods have the same return value as top-level document [#​9271](https://togithub.com/Automattic/mongoose/issues/9271) - docs(model): make `create()` docs use async/await, and add another warning about how `create()` with options requires array syntax [#​9280](https://togithub.com/Automattic/mongoose/issues/9280) - docs(connections): clarify that Mongoose can emit 'connected' when reconnecting after losing connectivity [#​9240](https://togithub.com/Automattic/mongoose/issues/9240) - docs(populate): clarify that you can't filter based on foreign document properties when populating [#​9279](https://togithub.com/Automattic/mongoose/issues/9279) - docs(document+model): clarify how `validateModifiedOnly` option works [#​9263](https://togithub.com/Automattic/mongoose/issues/9263) - docs: remove extra poolSize option in comment [#​9270](https://togithub.com/Automattic/mongoose/issues/9270) [shahvicky](https://togithub.com/shahvicky) - docs: point bulkWrite() link to mongoose docs instead of localhost [#​9284](https://togithub.com/Automattic/mongoose/issues/9284) ### [`v5.9.25`](https://togithub.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#​5925--2020-07-17) [Compare Source](https://togithub.com/Automattic/mongoose/compare/5.9.24...5.9.25) \=================== - fix(discriminator): allow passing a compiled model's schema as a parameter to `discriminator()` [#​9238](https://togithub.com/Automattic/mongoose/issues/9238) - fix(connection): throw more readable error when querying db before initial connection when `bufferCommands = false` [#​9239](https://togithub.com/Automattic/mongoose/issues/9239) - fix(indexes): don't unnecessarily drop text indexes when running `syncIndexes()` [#​9225](https://togithub.com/Automattic/mongoose/issues/9225) - fix: make Boolean \_castNullish respect omitUndefined [#​9242](https://togithub.com/Automattic/mongoose/issues/9242) [ehpc](https://togithub.com/ehpc) - fix(populate): populate single nested discriminator underneath doc array when populated docs have different model but same id [#​9244](https://togithub.com/Automattic/mongoose/issues/9244) - docs(mongoose): correct formatting typo [#​9247](https://togithub.com/Automattic/mongoose/issues/9247) [JNa0](https://togithub.com/JNa0) ### [`v5.9.24`](https://togithub.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#​5924--2020-07-13) [Compare Source](https://togithub.com/Automattic/mongoose/compare/5.9.23...5.9.24) \=================== - fix(connection): respect connection-level `bufferCommands` option if `mongoose.connect()` is called after `mongoose.model()` [#​9179](https://togithub.com/Automattic/mongoose/issues/9179) - fix(document): clear out `priorDoc` after overwriting single nested subdoc so changes after overwrite get persisted correctly [#​9208](https://togithub.com/Automattic/mongoose/issues/9208) - fix(connection): dont overwrite user-specified `bufferMaxEntries` when setting `bufferCommands` [#​9218](https://togithub.com/Automattic/mongoose/issues/9218) - fix(model): allow passing projection to `Model.hydrate()` [#​9209](https://togithub.com/Automattic/mongoose/issues/9209) - fix(schema+document): support adding `null` to schema boolean's `convertToFalse` set [#​9223](https://togithub.com/Automattic/mongoose/issues/9223) - docs(model): make `find` and `findOne()` examples use async/await and clarify `find({})` is find all [#​9210](https://togithub.com/Automattic/mongoose/issues/9210) ### [`v5.9.23`](https://togithub.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#​5923--2020-07-10) [Compare Source](https://togithub.com/Automattic/mongoose/compare/5.9.22...5.9.23) \=================== - fix(model): fix `syncIndexes()` error when db index has a collation but Mongoose index does not [#​9224](https://togithub.com/Automattic/mongoose/issues/9224) [clhuang](https://togithub.com/clhuang) - fix(array): only cast array to proper depth if it contains an non-array value [#​9217](https://togithub.com/Automattic/mongoose/issues/9217) [#​9215](https://togithub.com/Automattic/mongoose/issues/9215) [cyrilgandon](https://togithub.com/cyrilgandon) - docs(schematype): document the `transform` option [#​9211](https://togithub.com/Automattic/mongoose/issues/9211) - docs(mongoose): fix typo [#​9212](https://togithub.com/Automattic/mongoose/issues/9212) [JNa0](https://togithub.com/JNa0) ### [`v5.9.22`](https://togithub.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#​5922--2020-07-06) [Compare Source](https://togithub.com/Automattic/mongoose/compare/5.9.21...5.9.22) \=================== - fix(schema): treat `{ type: mongoose.Schema.Types.Array }` as equivalent to `{ type: Array }` [#​9194](https://togithub.com/Automattic/mongoose/issues/9194) - fix: revert fix for [#​9107](https://togithub.com/Automattic/mongoose/issues/9107) to avoid issues when calling `connect()` multiple times [#​9167](https://togithub.com/Automattic/mongoose/issues/9167) - fix(update): respect storeSubdocValidationError option with update validators [#​9172](https://togithub.com/Automattic/mongoose/issues/9172) - fix: upgrade to safe-buffer 5.2 [#​9198](https://togithub.com/Automattic/mongoose/issues/9198) - docs: add a note about SSL validation to migration guide [#​9147](https://togithub.com/Automattic/mongoose/issues/9147) - docs(schemas): fix inconsistent header [#​9196](https://togithub.com/Automattic/mongoose/issues/9196) [samtsai15](https://togithub.com/samtsai15) ### [`v5.9.21`](https://togithub.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#​5921--2020-07-01) [Compare Source](https://togithub.com/Automattic/mongoose/compare/5.9.20...5.9.21) \=================== - fix: propagate `typeKey` option to implicitly created schemas from `typePojoToMixed` [#​9185](https://togithub.com/Automattic/mongoose/issues/9185) [joaoritter](https://togithub.com/joaoritter) - fix(populate): handle embedded discriminator `refPath` with multiple documents [#​9153](https://togithub.com/Automattic/mongoose/issues/9153) - fix(populate): handle deselected foreign field with `perDocumentLimit` and multiple documents [#​9175](https://togithub.com/Automattic/mongoose/issues/9175) - fix(document): disallow `transform` functions that return promises [#​9176](https://togithub.com/Automattic/mongoose/issues/9176) [#​9163](https://togithub.com/Automattic/mongoose/issues/9163) [AbdelrahmanHafez](https://togithub.com/AbdelrahmanHafez) - fix(document): use strict equality when checking mixed paths for modifications [#​9165](https://togithub.com/Automattic/mongoose/issues/9165) - docs: add target="\_blank" to all edit links [#​9058](https://togithub.com/Automattic/mongoose/issues/9058) ### [`v5.9.20`](https://togithub.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#​5920--2020-06-22) [Compare Source](https://togithub.com/Automattic/mongoose/compare/5.9.19...5.9.20) \=================== - fix(populate): handle populating primitive array under document array discriminator [#​9148](https://togithub.com/Automattic/mongoose/issues/9148) - fix(connection): make sure to close previous connection when calling `openUri()` on an already open connection [#​9107](https://togithub.com/Automattic/mongoose/issues/9107) - fix(model): fix conflicting $setOnInsert default values with `update` values in bulkWrite [#​9160](https://togithub.com/Automattic/mongoose/issues/9160) [#​9157](https://togithub.com/Automattic/mongoose/issues/9157) [AbdelrahmanHafez](https://togithub.com/AbdelrahmanHafez) - docs(validation): add note about validateBeforeSave and invalidate [#​9144](https://togithub.com/Automattic/mongoose/issues/9144) [dandv](https://togithub.com/dandv) - docs: specify the array field syntax for invalidate [#​9137](https://togithub.com/Automattic/mongoose/issues/9137) [dandv](https://togithub.com/dandv) - docs: fix several typos and broken references [#​9024](https://togithub.com/Automattic/mongoose/issues/9024) [AbdelrahmanHafez](https://togithub.com/AbdelrahmanHafez) - docs: fix minor typo [#​9143](https://togithub.com/Automattic/mongoose/issues/9143) [dandv](https://togithub.com/dandv) ### [`v5.9.19`](https://togithub.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#​5919--2020-06-15) [Compare Source](https://togithub.com/Automattic/mongoose/compare/5.9.18...5.9.19) \=================== - fix: upgrade mongodb driver -> 3.5.9 [#​9124](https://togithub.com/Automattic/mongoose/issues/9124) [AbdelrahmanHafez](https://togithub.com/AbdelrahmanHafez) - fix: copy `required` validator on single nested subdoc correctly when calling `Schema#clone()` [#​8819](https://togithub.com/Automattic/mongoose/issues/8819) - fix(discriminator): handle `tiedValue` when casting update on nested paths [#​9108](https://togithub.com/Automattic/mongoose/issues/9108) - fix(model): allow empty arrays for bulkWrite [#​9132](https://togithub.com/Automattic/mongoose/issues/9132) [#​9131](https://togithub.com/Automattic/mongoose/issues/9131) [AbdelrahmanHafez](https://togithub.com/AbdelrahmanHafez) - fix(schema): correctly set partialFilterExpression for nested schema indexes [#​9091](https://togithub.com/Automattic/mongoose/issues/9091) - fix(castArrayFilters): handle casting on all fields of array filter [#​9122](https://togithub.com/Automattic/mongoose/issues/9122) [lafeuil](https://togithub.com/lafeuil) - fix(update): handle nested path createdAt when overwriting parent path [#​9105](https://togithub.com/Automattic/mongoose/issues/9105) - docs(subdocs): add some notes on the difference between single nested subdocs and nested paths [#​9085](https://togithub.com/Automattic/mongoose/issues/9085) - docs(subdocs): improve docs on `typePojoToMixed` [#​9085](https://togithub.com/Automattic/mongoose/issues/9085) - docs: add note about connections in `globalSetup` with Jest [#​9063](https://togithub.com/Automattic/mongoose/issues/9063) - docs: add schema and how to set default sub-schema to schematype options [#​9111](https://togithub.com/Automattic/mongoose/issues/9111) [dfle](https://togithub.com/dfle) - docs(index): use `const` instead of `var` in examples [#​9125](https://togithub.com/Automattic/mongoose/issues/9125) [dmcgrouther](https://togithub.com/dmcgrouther) - docs: corrected markdown typo [#​9117](https://togithub.com/Automattic/mongoose/issues/9117) ### [`v5.9.18`](https://togithub.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#​5918--2020-06-05) [Compare Source](https://togithub.com/Automattic/mongoose/compare/5.9.17...5.9.18) \=================== - fix: improve atlas error in the event of incorrect password [#​9095](https://togithub.com/Automattic/mongoose/issues/9095) - docs: add edit link for all docs pages [#​9058](https://togithub.com/Automattic/mongoose/issues/9058) - fix(document): allow accessing `$locals` when initializing document [#​9099](https://togithub.com/Automattic/mongoose/issues/9099) [#​9098](https://togithub.com/Automattic/mongoose/issues/9098) [AbdelrahmanHafez](https://togithub.com/AbdelrahmanHafez) - fix(query): make `setDefaultsOnInsert` a mongoose option so it doesn't end up in debug output [#​9086](https://togithub.com/Automattic/mongoose/issues/9086) - docs(connection+index): add serverSelectionTimeoutMS and heartbeatFrequencyMS to `connect()` and `openUri()` options [#​9071](https://togithub.com/Automattic/mongoose/issues/9071) - docs(geojson): add notes about geojson 2dsphere indexes [#​9044](https://togithub.com/Automattic/mongoose/issues/9044) - docs: make active page bold in navbar [#​9062](https://togithub.com/Automattic/mongoose/issues/9062) - docs: correct a typo in a code snippet [#​9089](https://togithub.com/Automattic/mongoose/issues/9089) [Elvis-Sarfo](https://togithub.com/Elvis-Sarfo) ### [`v5.9.17`](https://togithub.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#​5917--2020-06-02) [Compare Source](https://togithub.com/Automattic/mongoose/compare/5.9.16...5.9.17) \=================== - fix(document): avoid tracking changes like `splice()` on slice()-ed arrays [#​9011](https://togithub.com/Automattic/mongoose/issues/9011) - fix(populate): make populating a nested path a no-op [#​9073](https://togithub.com/Automattic/mongoose/issues/9073) - fix(document): clear nested cast errors when overwriting an array path [#​9080](https://togithub.com/Automattic/mongoose/issues/9080) - fix: upgrade mongodb to v3.5.8 [#​9069](https://togithub.com/Automattic/mongoose/issues/9069) [AbdelrahmanHafez](https://togithub.com/AbdelrahmanHafez) - docs(document): add validateModifiedOnly to Document#save(), Document#validateSync() and Document#validate() [#​9078](https://togithub.com/Automattic/mongoose/issues/9078) [AbdelrahmanHafez](https://togithub.com/AbdelrahmanHafez) - docs(faq): fix typo [#​9075](https://togithub.com/Automattic/mongoose/issues/9075) [tigransimonyan](https://togithub.com/tigransimonyan) - docs: document all parameters to .debug [#​9029](https://togithub.com/Automattic/mongoose/issues/9029) [dandv](https://togithub.com/dandv) - docs: fix property value in Getters example [#​9061](https://togithub.com/Automattic/mongoose/issues/9061) [ismet](https://togithub.com/ismet) ### [`v5.9.16`](https://togithub.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#​5916--2020-05-25) [Compare Source](https://togithub.com/Automattic/mongoose/compare/5.9.15...5.9.16) \=================== - perf(error): convert errors to classes extending Error for lower CPU overhead [#​9021](https://togithub.com/Automattic/mongoose/issues/9021) [zbjornson](https://togithub.com/zbjornson) - fix(query): throw CastError if filter `$and`, `$or`, `$nor` contain non-object values [#​8948](https://togithub.com/Automattic/mongoose/issues/8948) - fix(bulkwrite): cast filter & update to schema after applying timestamps [#​9030](https://togithub.com/Automattic/mongoose/issues/9030) [AbdelrahmanHafez](https://togithub.com/AbdelrahmanHafez) - fix(document): don't overwrite defaults with undefined keys in nested documents [#​9039](https://togithub.com/Automattic/mongoose/issues/9039) [vitorhnn](https://togithub.com/vitorhnn) - fix(discriminator): remove discriminator schema nested paths pulled from base schema underneath a mixed path in discriminator schema [#​9042](https://togithub.com/Automattic/mongoose/issues/9042) - fix(model): make syncIndexes() not drop index if all user-specified collation options are the same [#​8994](https://togithub.com/Automattic/mongoose/issues/8994) - fix(document): make internal `$__.scope` property a symbol instead to work around a bug with fast-safe-stringify [#​8955](https://togithub.com/Automattic/mongoose/issues/8955) - docs: model.findByIdAndUpdate() 'new' param fix [#​9026](https://togithub.com/Automattic/mongoose/issues/9026) [dandv](https://togithub.com/dandv) ### [`v5.9.15`](https://togithub.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#​5915--2020-05-18) [Compare Source](https://togithub.com/Automattic/mongoose/compare/5.9.14...5.9.15) \=================== - fix(schema): treat creating dotted path with no parent as creating a nested path [#​9020](https://togithub.com/Automattic/mongoose/issues/9020) - fix(documentarray): make sure you can call `unshift()` after `map()` [#​9012](https://togithub.com/Automattic/mongoose/issues/9012) [philippejer](https://togithub.com/philippejer) - fix(model): cast bulkwrite according to discriminator schema if discriminator key is present [#​8982](https://togithub.com/Automattic/mongoose/issues/8982) [AbdelrahmanHafez](https://togithub.com/AbdelrahmanHafez) - fix(schema): remove `db` from reserved keywords [#​8940](https://togithub.com/Automattic/mongoose/issues/8940) - fix(populate): treat populating a doc array that doesn't have a `ref` as a no-op [#​8946](https://togithub.com/Automattic/mongoose/issues/8946) - fix(timestamps): set createdAt and updatedAt on doubly nested subdocs when upserting [#​8894](https://togithub.com/Automattic/mongoose/issues/8894) - fix(model): allow POJOs as schemas for model.discriminator(...) [#​8991](https://togithub.com/Automattic/mongoose/issues/8991) [AbdelrahmanHafez](https://togithub.com/AbdelrahmanHafez) - fix(model): report `insertedDocs` on `insertMany()` errors [#​8938](https://togithub.com/Automattic/mongoose/issues/8938) - fix(model): ensure consistent `writeErrors` property on insertMany error with `ordered: false`, even if only one op failed [#​8938](https://togithub.com/Automattic/mongoose/issues/8938) - docs: add anchor tag to strictQuery and strict [#​9014](https://togithub.com/Automattic/mongoose/issues/9014) [AbdelrahmanHafez](https://togithub.com/AbdelrahmanHafez) - docs(faq): remove faq ipv6 [#​9004](https://togithub.com/Automattic/mongoose/issues/9004) - docs: add note about throwing error only after validation and fix broken reference to api/CastError [#​8993](https://togithub.com/Automattic/mongoose/issues/8993) [AbdelrahmanHafez](https://togithub.com/AbdelrahmanHafez) - docs: fix typos in documents.pug [#​9005](https://togithub.com/Automattic/mongoose/issues/9005) [dandv](https://togithub.com/dandv) ### [`v5.9.14`](https://togithub.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#​5914--2020-05-13) [Compare Source](https://togithub.com/Automattic/mongoose/compare/5.9.13...5.9.14) \=================== - fix(cursor): add index as second parameter to eachAsync callback [#​8972](https://togithub.com/Automattic/mongoose/issues/8972) [AbdelrahmanHafez](https://togithub.com/AbdelrahmanHafez) - fix(query): cast filter according to discriminator schema if discriminator key in filter [#​8881](https://togithub.com/Automattic/mongoose/issues/8881) - fix(model): fix throwing error when populating virtual path defined on child discriminator [#​8924](https://togithub.com/Automattic/mongoose/issues/8924) [AbdelrahmanHafez](https://togithub.com/AbdelrahmanHafez) - fix(errors): handle case when user has make `Error.prototype.toJSON` read only [#​8986](https://togithub.com/Automattic/mongoose/issues/8986) [osher](https://togithub.com/osher) - fix(model): add `kind` to cast errors thrown by query execution [#​8953](https://togithub.com/Automattic/mongoose/issues/8953) [AbdelrahmanHafez](https://togithub.com/AbdelrahmanHafez) - fix(update): use child schema strict on single nested updates if useNestedStrict not set [#​8922](https://togithub.com/Automattic/mongoose/issues/8922) - docs(model): improve `save()` docs [#​8956](https://togithub.com/Automattic/mongoose/issues/8956) [AbdelrahmanHafez](https://togithub.com/AbdelrahmanHafez) - docs: add immutable type to Schema Types [#​8987](https://togithub.com/Automattic/mongoose/issues/8987) [Andrew5569](https://togithub.com/Andrew5569) - docs: sort schema reserved keys in documentation [#​8966](https://togithub.com/Automattic/mongoose/issues/8966) [AbdelrahmanHafez](http