Automattic/mongoose (mongoose)
### [`v8.8.0`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#880--2024-10-31)
[Compare Source](https://redirect.github.com/Automattic/mongoose/compare/8.7.3...8.8.0)
\==================
- feat: upgrade mongodb -> ~6.10 [#14991](https://redirect.github.com/Automattic/mongoose/issues/14991) [#14877](https://redirect.github.com/Automattic/mongoose/issues/14877)
- feat(query): add schemaLevelProjections option to query to disable schema-level select: false [#14986](https://redirect.github.com/Automattic/mongoose/issues/14986) [#11474](https://redirect.github.com/Automattic/mongoose/issues/11474)
- feat: allow defining virtuals on arrays, not just array elements [#14955](https://redirect.github.com/Automattic/mongoose/issues/14955) [#2326](https://redirect.github.com/Automattic/mongoose/issues/2326)
- feat(model): add applyTimestamps() function to apply all schema timestamps, including subdocuments, to a given POJO [#14943](https://redirect.github.com/Automattic/mongoose/issues/14943) [#14698](https://redirect.github.com/Automattic/mongoose/issues/14698)
- feat(model): add hideIndexes option to syncIndexes() and cleanIndexes() [#14987](https://redirect.github.com/Automattic/mongoose/issues/14987) [#14868](https://redirect.github.com/Automattic/mongoose/issues/14868)
- fix(query): make sanitizeFilter disable implicit $in [#14985](https://redirect.github.com/Automattic/mongoose/issues/14985) [#14657](https://redirect.github.com/Automattic/mongoose/issues/14657)
- fix(model): avoid unhandled error if createIndex() throws a sync error [#14995](https://redirect.github.com/Automattic/mongoose/issues/14995)
- fix(model): avoid throwing TypeError if bulkSave()'s bulkWrite() fails with a non-BulkWriteError [#14993](https://redirect.github.com/Automattic/mongoose/issues/14993)
- types: added toJSON:flattenObjectIds effect [#14989](https://redirect.github.com/Automattic/mongoose/issues/14989)
- types: add `__v` to lean() result type and ModifyResult [#14990](https://redirect.github.com/Automattic/mongoose/issues/14990) [#12959](https://redirect.github.com/Automattic/mongoose/issues/12959)
- types: use globalThis instead of global for NativeDate [#14992](https://redirect.github.com/Automattic/mongoose/issues/14992) [#14988](https://redirect.github.com/Automattic/mongoose/issues/14988)
- docs(change-streams): fix markdown syntax highlighting for script output example [#14994](https://redirect.github.com/Automattic/mongoose/issues/14994)
### [`v8.7.3`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#873--2024-10-25)
[Compare Source](https://redirect.github.com/Automattic/mongoose/compare/8.7.2...8.7.3)
\==================
- fix(cursor): close underlying query cursor when calling destroy() [#14982](https://redirect.github.com/Automattic/mongoose/issues/14982) [#14966](https://redirect.github.com/Automattic/mongoose/issues/14966)
- types: add JSONSerialized helper that can convert HydratedDocument to JSON output type [#14981](https://redirect.github.com/Automattic/mongoose/issues/14981) [#14451](https://redirect.github.com/Automattic/mongoose/issues/14451)
- types(model): convert InsertManyResult to interface and remove unnecessary insertedIds override [#14977](https://redirect.github.com/Automattic/mongoose/issues/14977)
- types(connection): add missing sanitizeFilter option [#14975](https://redirect.github.com/Automattic/mongoose/issues/14975)
- types: improve goto definition for inferred schema definitions [#14968](https://redirect.github.com/Automattic/mongoose/issues/14968) [forivall](https://redirect.github.com/forivall)
- docs(migration-guide-v7): correct link to the section "Id Setter" [#14973](https://redirect.github.com/Automattic/mongoose/issues/14973) [rb-ntnx](https://redirect.github.com/rb-ntnx)
### [`v8.7.2`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#872--2024-10-17)
[Compare Source](https://redirect.github.com/Automattic/mongoose/compare/8.7.1...8.7.2)
\==================
- fix(document): recursively clear modified subpaths when setting deeply nested subdoc to null [#14963](https://redirect.github.com/Automattic/mongoose/issues/14963) [#14952](https://redirect.github.com/Automattic/mongoose/issues/14952)
- fix(populate): handle array of ids with parent refPath [#14965](https://redirect.github.com/Automattic/mongoose/issues/14965)
- types: make Buffers into mongodb.Binary in lean result type to match runtime behavior [#14967](https://redirect.github.com/Automattic/mongoose/issues/14967)
- types: correct schema type inference when using nested typeKey like type: { type: String } [#14956](https://redirect.github.com/Automattic/mongoose/issues/14956) [#14950](https://redirect.github.com/Automattic/mongoose/issues/14950)
- types: re-export DeleteResult and UpdateResult from MongoDB Node.js driver [#14947](https://redirect.github.com/Automattic/mongoose/issues/14947) [#14946](https://redirect.github.com/Automattic/mongoose/issues/14946)
- docs(documents): add section on setting deeply nested properties, including warning about nullish coalescing assignment [#14972](https://redirect.github.com/Automattic/mongoose/issues/14972)
- docs(model): add more info on acknowledged: false, specifically that Mongoose may return that if the update was empty [#14957](https://redirect.github.com/Automattic/mongoose/issues/14957)
### [`v8.7.1`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#871--2024-10-09)
[Compare Source](https://redirect.github.com/Automattic/mongoose/compare/8.7.0...8.7.1)
\==================
- fix: set flattenObjectIds to false when calling toObject() for internal purposes [#14938](https://redirect.github.com/Automattic/mongoose/issues/14938)
- fix: add mongodb 8 to test matrix [#14937](https://redirect.github.com/Automattic/mongoose/issues/14937)
- fix: handle buffers stored in MongoDB as EJSON representation with { $binary } [#14932](https://redirect.github.com/Automattic/mongoose/issues/14932)
- docs: indicate that Mongoose 8.7 is required for full MongoDB 8 support [#14937](https://redirect.github.com/Automattic/mongoose/issues/14937)
### [`v8.7.0`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#870--2024-09-27)
[Compare Source](https://redirect.github.com/Automattic/mongoose/compare/8.6.4...8.7.0)
\==================
- feat(model): add Model.applyVirtuals() to apply virtuals to a POJO [#14905](https://redirect.github.com/Automattic/mongoose/issues/14905) [#14818](https://redirect.github.com/Automattic/mongoose/issues/14818)
- feat: upgrade mongodb -> 6.9.0 [#14914](https://redirect.github.com/Automattic/mongoose/issues/14914)
- feat(query): cast $rename to string [#14887](https://redirect.github.com/Automattic/mongoose/issues/14887) [#3027](https://redirect.github.com/Automattic/mongoose/issues/3027)
- feat(SchemaType): add getEmbeddedSchemaType() method to SchemaTypes [#14880](https://redirect.github.com/Automattic/mongoose/issues/14880) [#8389](https://redirect.github.com/Automattic/mongoose/issues/8389)
- fix(model): throw MongooseBulkSaveIncompleteError if bulkSave() didn't completely succeed [#14884](https://redirect.github.com/Automattic/mongoose/issues/14884) [#14763](https://redirect.github.com/Automattic/mongoose/issues/14763)
- fix(connection): avoid returning readyState = connected if connection state is stale [#14812](https://redirect.github.com/Automattic/mongoose/issues/14812) [#14727](https://redirect.github.com/Automattic/mongoose/issues/14727)
- fix: depopulate if push() or addToSet() with an ObjectId on a populated array [#14883](https://redirect.github.com/Automattic/mongoose/issues/14883) [#1635](https://redirect.github.com/Automattic/mongoose/issues/1635)
- types: make \__v a number, only set \__v on top-level documents [#14892](https://redirect.github.com/Automattic/mongoose/issues/14892)
### [`v8.6.4`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#864--2024-09-26)
[Compare Source](https://redirect.github.com/Automattic/mongoose/compare/8.6.3...8.6.4)
\==================
- fix(document): avoid massive perf degradation when saving new doc with 10 level deep subdocs [#14910](https://redirect.github.com/Automattic/mongoose/issues/14910) [#14897](https://redirect.github.com/Automattic/mongoose/issues/14897)
- fix(model): skip applying static hooks by default if static name conflicts with aggregate middleware [#14904](https://redirect.github.com/Automattic/mongoose/issues/14904) [dragontaek-lee](https://redirect.github.com/dragontaek-lee)
- fix(model): filter applying static hooks by default if static name conflicts with mongoose middleware [#14908](https://redirect.github.com/Automattic/mongoose/issues/14908) [dragontaek-lee](https://redirect.github.com/dragontaek-lee)
### [`v8.6.3`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#863--2024-09-17)
[Compare Source](https://redirect.github.com/Automattic/mongoose/compare/8.6.2...8.6.3)
\==================
- fix: make getters convert uuid to string when calling toObject() and toJSON() [#14890](https://redirect.github.com/Automattic/mongoose/issues/14890) [#14869](https://redirect.github.com/Automattic/mongoose/issues/14869)
- fix: fix missing Aggregate re-exports for ESM [#14886](https://redirect.github.com/Automattic/mongoose/issues/14886) [wongsean](https://redirect.github.com/wongsean)
- types(document): add generic param to depopulate() to allow updating properties [#14891](https://redirect.github.com/Automattic/mongoose/issues/14891) [#14876](https://redirect.github.com/Automattic/mongoose/issues/14876)
### [`v8.6.2`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#862--2024-09-11)
[Compare Source](https://redirect.github.com/Automattic/mongoose/compare/8.6.1...8.6.2)
\==================
- fix: make set merge deeply nested objects [#14870](https://redirect.github.com/Automattic/mongoose/issues/14870) [#14861](https://redirect.github.com/Automattic/mongoose/issues/14861) [ianHeydoc](https://redirect.github.com/ianHeydoc)
- types: allow arbitrary keys in query filters again (revert [#14764](https://redirect.github.com/Automattic/mongoose/issues/14764)) [#14874](https://redirect.github.com/Automattic/mongoose/issues/14874) [#14863](https://redirect.github.com/Automattic/mongoose/issues/14863) [#14862](https://redirect.github.com/Automattic/mongoose/issues/14862) [#14842](https://redirect.github.com/Automattic/mongoose/issues/14842)
- types: make SchemaType static setters property accessible in TypeScript [#14881](https://redirect.github.com/Automattic/mongoose/issues/14881) [#14879](https://redirect.github.com/Automattic/mongoose/issues/14879)
- type(inferrawdoctype): infer Date types as JS dates rather than Mongoose SchemaType Date [#14882](https://redirect.github.com/Automattic/mongoose/issues/14882) [#14839](https://redirect.github.com/Automattic/mongoose/issues/14839)
### [`v8.6.1`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#861--2024-09-03)
[Compare Source](https://redirect.github.com/Automattic/mongoose/compare/8.6.0...8.6.1)
\==================
- fix(document): avoid unnecessary clone() in applyGetters() that was preventing getters from running on 3-level deep subdocuments [#14844](https://redirect.github.com/Automattic/mongoose/issues/14844) [#14840](https://redirect.github.com/Automattic/mongoose/issues/14840) [#14835](https://redirect.github.com/Automattic/mongoose/issues/14835)
- fix(model): throw error if bulkSave() did not insert or update any documents [#14837](https://redirect.github.com/Automattic/mongoose/issues/14837) [#14763](https://redirect.github.com/Automattic/mongoose/issues/14763)
- fix(cursor): throw error in ChangeStream constructor if changeStreamThunk() throws a sync error [#14846](https://redirect.github.com/Automattic/mongoose/issues/14846)
- types(query): add $expr to RootQuerySelector [#14845](https://redirect.github.com/Automattic/mongoose/issues/14845)
- docs: update populate.md to fix missing match: { } [#14847](https://redirect.github.com/Automattic/mongoose/issues/14847) [makhoulshbeeb](https://redirect.github.com/makhoulshbeeb)
### [`v8.6.0`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#860--2024-08-28)
[Compare Source](https://redirect.github.com/Automattic/mongoose/compare/8.5.5...8.6.0)
\==================
- feat: upgrade mongodb -> 6.8.0, handle throwing error on closed cursor in Mongoose with `MongooseError` instead of `MongoCursorExhaustedError` [#14813](https://redirect.github.com/Automattic/mongoose/issues/14813)
- feat(model+query): support options parameter for distinct() [#14772](https://redirect.github.com/Automattic/mongoose/issues/14772) [#8006](https://redirect.github.com/Automattic/mongoose/issues/8006)
- feat(QueryCursor): add getDriverCursor() function that returns the raw driver cursor [#14745](https://redirect.github.com/Automattic/mongoose/issues/14745)
- types: change query selector to disallow unknown top-level keys by default [#14764](https://redirect.github.com/Automattic/mongoose/issues/14764) [alex-statsig](https://redirect.github.com/alex-statsig)
- types: make toObject() and toJSON() not generic by default to avoid type widening [#14819](https://redirect.github.com/Automattic/mongoose/issues/14819) [#12883](https://redirect.github.com/Automattic/mongoose/issues/12883)
- types: avoid automatically inferring lean result type when assigning to explicitly typed variable [#14734](https://redirect.github.com/Automattic/mongoose/issues/14734)
### [`v8.5.5`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#855--2024-08-28)
[Compare Source](https://redirect.github.com/Automattic/mongoose/compare/8.5.4...8.5.5)
\==================
- fix(populate): fix a couple of other places where Mongoose gets the document's \_id with getters [#14833](https://redirect.github.com/Automattic/mongoose/issues/14833) [#14827](https://redirect.github.com/Automattic/mongoose/issues/14827) [#14759](https://redirect.github.com/Automattic/mongoose/issues/14759)
- fix(discriminator): shallow clone Schema.prototype.obj before merging schemas to avoid modifying original obj [#14821](https://redirect.github.com/Automattic/mongoose/issues/14821)
- types: fix schema type based on timestamps schema options value [#14829](https://redirect.github.com/Automattic/mongoose/issues/14829) [#14825](https://redirect.github.com/Automattic/mongoose/issues/14825) [ark23CIS](https://redirect.github.com/ark23CIS)
### [`v8.5.4`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#854--2024-08-23)
[Compare Source](https://redirect.github.com/Automattic/mongoose/compare/8.5.3...8.5.4)
\==================
- fix: add empty string check for collection name passed [#14806](https://redirect.github.com/Automattic/mongoose/issues/14806) [Shubham2552](https://redirect.github.com/Shubham2552)
- docs(model): add 'throw' as valid strict value for bulkWrite() and add some more clarification on throwOnValidationError [#14809](https://redirect.github.com/Automattic/mongoose/issues/14809)
### [`v8.5.3`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#853--2024-08-13)
[Compare Source](https://redirect.github.com/Automattic/mongoose/compare/8.5.2...8.5.3)
\==================
- fix(document): call required functions on subdocuments underneath nested paths with correct context [#14801](https://redirect.github.com/Automattic/mongoose/issues/14801) [#14788](https://redirect.github.com/Automattic/mongoose/issues/14788)
- fix(populate): avoid throwing error when no result and `lean()` set [#14799](https://redirect.github.com/Automattic/mongoose/issues/14799) [#14794](https://redirect.github.com/Automattic/mongoose/issues/14794) [#14759](https://redirect.github.com/Automattic/mongoose/issues/14759) [MohOraby](https://redirect.github.com/MohOraby)
- fix(document): apply virtuals to subdocuments if parent schema has virtuals: true for backwards compatibility [#14774](https://redirect.github.com/Automattic/mongoose/issues/14774) [#14771](https://redirect.github.com/Automattic/mongoose/issues/14771) [#14623](https://redirect.github.com/Automattic/mongoose/issues/14623) [#14394](https://redirect.github.com/Automattic/mongoose/issues/14394)
- types: make HydratedSingleSubdocument and HydratedArraySubdocument merge types instead of using & [#14800](https://redirect.github.com/Automattic/mongoose/issues/14800) [#14793](https://redirect.github.com/Automattic/mongoose/issues/14793)
- types: support schema type inference based on schema options timestamps as well [#14773](https://redirect.github.com/Automattic/mongoose/issues/14773) [#13215](https://redirect.github.com/Automattic/mongoose/issues/13215) [ark23CIS](https://redirect.github.com/ark23CIS)
- types(cursor): indicate that cursor.next() can return null [#14798](https://redirect.github.com/Automattic/mongoose/issues/14798) [#14787](https://redirect.github.com/Automattic/mongoose/issues/14787)
- types: allow mongoose.connection.db to be undefined [#14797](https://redirect.github.com/Automattic/mongoose/issues/14797) [#14789](https://redirect.github.com/Automattic/mongoose/issues/14789)
- docs: add schema type widening advice [#14790](https://redirect.github.com/Automattic/mongoose/issues/14790) [JstnMcBrd](https://redirect.github.com/JstnMcBrd)
### [`v8.5.2`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#852--2024-07-30)
[Compare Source](https://redirect.github.com/Automattic/mongoose/compare/8.5.1...8.5.2)
\==================
- perf(clone): avoid further unnecessary checks if cloning a primitive value [#14762](https://redirect.github.com/Automattic/mongoose/issues/14762) [#14394](https://redirect.github.com/Automattic/mongoose/issues/14394)
- fix: allow setting document array default to null [#14769](https://redirect.github.com/Automattic/mongoose/issues/14769) [#14717](https://redirect.github.com/Automattic/mongoose/issues/14717) [#6691](https://redirect.github.com/Automattic/mongoose/issues/6691)
- fix(model): support session: null option for save() to opt out of automatic session option with transactionAsyncLocalStorage [#14744](https://redirect.github.com/Automattic/mongoose/issues/14744) [#14736](https://redirect.github.com/Automattic/mongoose/issues/14736)
- fix(model+document): avoid depopulating manually populated doc as getter value [#14760](https://redirect.github.com/Automattic/mongoose/issues/14760) [#14759](https://redirect.github.com/Automattic/mongoose/issues/14759)
- fix: correct shardkey access in buildBulkWriteOps [#14753](https://redirect.github.com/Automattic/mongoose/issues/14753) [#14752](https://redirect.github.com/Automattic/mongoose/issues/14752) [adf0nt3s](https://redirect.github.com/adf0nt3s)
- fix(query): handle casting $switch in $expr [#14755](https://redirect.github.com/Automattic/mongoose/issues/14755) [#14751](https://redirect.github.com/Automattic/mongoose/issues/14751)
- types: allow calling SchemaType.cast() without parent and init parameters [#14756](https://redirect.github.com/Automattic/mongoose/issues/14756) [#14748](https://redirect.github.com/Automattic/mongoose/issues/14748) [#9076](https://redirect.github.com/Automattic/mongoose/issues/9076)
- docs: fix a wrong example in v6 migration guide [#14758](https://redirect.github.com/Automattic/mongoose/issues/14758) [abdelrahman-elkady](https://redirect.github.com/abdelrahman-elkady)
### [`v8.5.1`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#851--2024-07-12)
[Compare Source](https://redirect.github.com/Automattic/mongoose/compare/8.5.0...8.5.1)
\==================
- perf(model): performance improvements for insertMany() [#14724](https://redirect.github.com/Automattic/mongoose/issues/14724)
- fix(model): avoid leaving subdoc defaults on top-level doc when setting subdocument to same value [#14728](https://redirect.github.com/Automattic/mongoose/issues/14728) [#14722](https://redirect.github.com/Automattic/mongoose/issues/14722)
- fix(model): handle transactionAsyncLocalStorage option with insertMany() [#14743](https://redirect.github.com/Automattic/mongoose/issues/14743)
- types: make \_id required on Document type [#14735](https://redirect.github.com/Automattic/mongoose/issues/14735) [#14660](https://redirect.github.com/Automattic/mongoose/issues/14660)
- types: fix ChangeStream.close to return a Promise like the driver [#14740](https://redirect.github.com/Automattic/mongoose/issues/14740) [orgads](https://redirect.github.com/orgads)
### [`v8.5.0`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#850--2024-07-08)
[Compare Source](https://redirect.github.com/Automattic/mongoose/compare/8.4.5...8.5.0)
\==================
- perf: memoize toJSON / toObject default options [#14672](https://redirect.github.com/Automattic/mongoose/issues/14672)
- feat(document): add $createModifiedPathsSnapshot(), $restoreModifiedPathsSnapshot(), $clearModifiedPaths() [#14699](https://redirect.github.com/Automattic/mongoose/issues/14699) [#14268](https://redirect.github.com/Automattic/mongoose/issues/14268)
- feat(query): make sanitizeProjection prevent projecting in paths deselected in the schema [#14691](https://redirect.github.com/Automattic/mongoose/issues/14691)
- feat: allow setting array default value to null [#14717](https://redirect.github.com/Automattic/mongoose/issues/14717) [#6691](https://redirect.github.com/Automattic/mongoose/issues/6691)
- feat(mongoose): allow drivers to set global plugins [#14682](https://redirect.github.com/Automattic/mongoose/issues/14682)
- feat(connection): bubble up monitorCommands events to Mongoose connection if monitorCommands option set [#14681](https://redirect.github.com/Automattic/mongoose/issues/14681) [#14611](https://redirect.github.com/Automattic/mongoose/issues/14611)
- fix(document): ensure post('deleteOne') hooks are called when calling save() after subdoc.deleteOne() [#14732](https://redirect.github.com/Automattic/mongoose/issues/14732) [#9885](https://redirect.github.com/Automattic/mongoose/issues/9885)
- fix(query): remove count() and findOneAndRemove() from query chaining [#14692](https://redirect.github.com/Automattic/mongoose/issues/14692) [#14689](https://redirect.github.com/Automattic/mongoose/issues/14689)
- fix: remove default connection if setting createInitialConnection to false after Mongoose instance created [#14679](https://redirect.github.com/Automattic/mongoose/issues/14679) [#8302](https://redirect.github.com/Automattic/mongoose/issues/8302)
- types(models+query): infer return type from schema for 1-level deep nested paths [#14632](https://redirect.github.com/Automattic/mongoose/issues/14632)
- types(connection): make transaction() return type match the executor function [#14661](https://redirect.github.com/Automattic/mongoose/issues/14661) [#14656](https://redirect.github.com/Automattic/mongoose/issues/14656)
- docs: fix docs links in index.md [mirasayon](https://redirect.github.com/mirasayon)
### [`v8.4.5`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#845--2024-07-05)
[Compare Source](https://redirect.github.com/Automattic/mongoose/compare/8.4.4...8.4.5)
\==================
- types: correct this for validate.validator schematype option [#14720](https://redirect.github.com/Automattic/mongoose/issues/14720) [#14696](https://redirect.github.com/Automattic/mongoose/issues/14696)
- docs(model): note that insertMany() with lean skips applying defaults [#14723](https://redirect.github.com/Automattic/mongoose/issues/14723) [#14698](https://redirect.github.com/Automattic/mongoose/issues/14698)
### [`v8.4.4`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#844--2024-06-25)
[Compare Source](https://redirect.github.com/Automattic/mongoose/compare/8.4.3...8.4.4)
\==================
- perf: avoid unnecesary get() call and use faster approach for converting to string [#14673](https://redirect.github.com/Automattic/mongoose/issues/14673) [#14394](https://redirect.github.com/Automattic/mongoose/issues/14394)
- fix(projection): handle projections on arrays in Model.hydrate() projection option [#14686](https://redirect.github.com/Automattic/mongoose/issues/14686) [#14680](https://redirect.github.com/Automattic/mongoose/issues/14680)
- fix(document): avoid passing validateModifiedOnly to subdocs so subdocs get fully validating if they're directly modified [#14685](https://redirect.github.com/Automattic/mongoose/issues/14685) [#14677](https://redirect.github.com/Automattic/mongoose/issues/14677)
- fix: handle casting primitive array with $elemMatch in bulkWrite() [#14687](https://redirect.github.com/Automattic/mongoose/issues/14687) [#14678](https://redirect.github.com/Automattic/mongoose/issues/14678)
- fix(query): cast $pull using embedded discriminator schema when discriminator key is set in filter [#14676](https://redirect.github.com/Automattic/mongoose/issues/14676) [#14675](https://redirect.github.com/Automattic/mongoose/issues/14675)
- types(connection): fix return type of withSession() [#14690](https://redirect.github.com/Automattic/mongoose/issues/14690) [tt-public](https://redirect.github.com/tt-public)
- types: add $documents pipeline stage and fix $unionWith type [#14666](https://redirect.github.com/Automattic/mongoose/issues/14666) [nick-statsig](https://redirect.github.com/nick-statsig)
- docs(findoneandupdate): improve example that shows findOneAndUpdate() returning doc before updates were applied [#14671](https://redirect.github.com/Automattic/mongoose/issues/14671) [#14670](https://redirect.github.com/Automattic/mongoose/issues/14670)
### [`v8.4.3`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#843--2024-06-17)
[Compare Source](https://redirect.github.com/Automattic/mongoose/compare/8.4.2...8.4.3)
\==================
- fix: remove 0x flamegraph files from release
### [`v8.4.2`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#842--2024-06-17)
[Compare Source](https://redirect.github.com/Automattic/mongoose/compare/8.4.1...8.4.2)
\==================
- perf: more toObject() perf improvements [#14623](https://redirect.github.com/Automattic/mongoose/issues/14623) [#14606](https://redirect.github.com/Automattic/mongoose/issues/14606) [#14394](https://redirect.github.com/Automattic/mongoose/issues/14394)
- fix(model): check the value of overwriteModels in options when calling discriminator() [#14646](https://redirect.github.com/Automattic/mongoose/issues/14646) [uditha-g](https://redirect.github.com/uditha-g)
- fix: avoid throwing TypeError when deleting an null entry on a populated Map [#14654](https://redirect.github.com/Automattic/mongoose/issues/14654) [futurliberta](https://redirect.github.com/futurliberta)
- fix(connection): fix up some inconsistencies in operation-end event and add to docs [#14659](https://redirect.github.com/Automattic/mongoose/issues/14659) [#14648](https://redirect.github.com/Automattic/mongoose/issues/14648)
- types: avoid inferring Boolean, Buffer, ObjectId as Date in schema definitions under certain circumstances [#14667](https://redirect.github.com/Automattic/mongoose/issues/14667) [#14630](https://redirect.github.com/Automattic/mongoose/issues/14630)
- docs: add note about parallelism in transations [#14647](https://redirect.github.com/Automattic/mongoose/issues/14647) [fiws](https://redirect.github.com/fiws)
### [`v8.4.1`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#841--2024-05-31)
[Compare Source](https://redirect.github.com/Automattic/mongoose/compare/8.4.0...8.4.1)
\==================
- fix: pass options to clone instead of get in applyVirtuals [#14606](https://redirect.github.com/Automattic/mongoose/issues/14606) [#14543](https://redirect.github.com/Automattic/mongoose/issues/14543) [andrews05](https://redirect.github.com/andrews05)
- fix(document): fire pre validate hooks on 5 level deep single nested subdoc when modifying after save() [#14604](https://redirect.github.com/Automattic/mongoose/issues/14604) [#14591](https://redirect.github.com/Automattic/mongoose/issues/14591)
- fix: ensure buildBulkWriteOperations target shard if shardKey is set [#14622](https://redirect.github.com/Automattic/mongoose/issues/14622) [#14621](https://redirect.github.com/Automattic/mongoose/issues/14621) [matlpriceshape](https://redirect.github.com/matlpriceshape)
- types: pass DocType down to subdocuments so HydratedSingleSubdocument and HydratedArraySubdocument toObject() returns correct type [#14612](https://redirect.github.com/Automattic/mongoose/issues/14612) [#14601](https://redirect.github.com/Automattic/mongoose/issues/14601)
### [`v8.4.0`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#840--2024-05-17)
[Compare Source](https://redirect.github.com/Automattic/mongoose/compare/8.3.5...8.4.0)
\==================
- feat: upgrade mongodb -> 6.6.2 [#14584](https://redirect.github.com/Automattic/mongoose/issues/14584)
- feat: add transactionAsyncLocalStorage option to opt in to automatically setting session on all transactions [#14583](https://redirect.github.com/Automattic/mongoose/issues/14583) [#13889](https://redirect.github.com/Automattic/mongoose/issues/13889)
- feat: handle initially null driver when instantiating Mongoose for Rollup support [#14577](https://redirect.github.com/Automattic/mongoose/issues/14577) [#12335](https://redirect.github.com/Automattic/mongoose/issues/12335)
- feat(mongoose): export omitUndefined() helper [#14582](https://redirect.github.com/Automattic/mongoose/issues/14582) [#14569](https://redirect.github.com/Automattic/mongoose/issues/14569)
- feat: add Model.listSearchIndexes() [#14519](https://redirect.github.com/Automattic/mongoose/issues/14519) [#14450](https://redirect.github.com/Automattic/mongoose/issues/14450)
- feat(connection): add listDatabases() function [#14506](https://redirect.github.com/Automattic/mongoose/issues/14506) [#9048](https://redirect.github.com/Automattic/mongoose/issues/9048)
- feat(schema): add schema-level readConcern option to apply default readConcern for all queries [#14579](https://redirect.github.com/Automattic/mongoose/issues/14579) [#14511](https://redirect.github.com/Automattic/mongoose/issues/14511)
- fix(error): remove model property from CastError to avoid printing all model properties to console [#14568](https://redirect.github.com/Automattic/mongoose/issues/14568) [#14529](https://redirect.github.com/Automattic/mongoose/issues/14529)
- fix(model): make bulkWrite() and insertMany() throw if throwOnValidationError set and all ops invalid [#14587](https://redirect.github.com/Automattic/mongoose/issues/14587) [#14572](https://redirect.github.com/Automattic/mongoose/issues/14572)
- fix(document): ensure transform function passed to toObject() options applies to subdocs [#14600](https://redirect.github.com/Automattic/mongoose/issues/14600) [#14589](https://redirect.github.com/Automattic/mongoose/issues/14589)
- types: add inferRawDocType helper [#13900](https://redirect.github.com/Automattic/mongoose/issues/13900) [#13772](https://redirect.github.com/Automattic/mongoose/issues/13772)
- types(document): make document \_id type default to unknown instead of any [#14541](https://redirect.github.com/Automattic/mongoose/issues/14541)
### [`v8.3.5`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#835--2024-05-15)
[Compare Source](https://redirect.github.com/Automattic/mongoose/compare/8.3.4...8.3.5)
\==================
- fix(query): shallow clone $or, $and if merging onto empty query filter [#14580](https://redirect.github.com/Automattic/mongoose/issues/14580) [#14567](https://redirect.github.com/Automattic/mongoose/issues/14567)
- types(model+query): pass TInstanceMethods to QueryWithHelpers so populated docs have methods [#14581](https://redirect.github.com/Automattic/mongoose/issues/14581) [#14574](https://redirect.github.com/Automattic/mongoose/issues/14574)
- docs(typescript): clarify that setting THydratedDocumentType on schemas is necessary for correct method context [#14575](https://redirect.github.com/Automattic/mongoose/issues/14575) [#14573](https://redirect.github.com/Automattic/mongoose/issues/14573)
### [`v8.3.4`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#834--2024-05-06)
[Compare Source](https://redirect.github.com/Automattic/mongoose/compare/8.3.3...8.3.4)
\==================
- perf(document): avoid cloning options using spread operator for perf reasons [#14565](https://redirect.github.com/Automattic/mongoose/issues/14565) [#14394](https://redirect.github.com/Automattic/mongoose/issues/14394)
- fix(query): apply translateAliases before casting to avoid strictMode error when using aliases [#14562](https://redirect.github.com/Automattic/mongoose/issues/14562) [#14521](https://redirect.github.com/Automattic/mongoose/issues/14521)
- fix(model): consistent top-level timestamps option for bulkWrite operations
[#14546](https://redirect.github.com/Automattic/mongoose/issues/14546) [#14536](https://redirect.github.com/Automattic/mongoose/issues/14536)
- docs(connections): improve description of connection creation patterns [#14564](https://redirect.github.com/Automattic/mongoose/issues/14564) [#14528](https://redirect.github.com/Automattic/mongoose/issues/14528)
### [`v8.3.3`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#833--2024-04-29)
[Compare Source](https://redirect.github.com/Automattic/mongoose/compare/8.3.2...8.3.3)
\==================
- perf(document): add fast path for applying non-nested virtuals to JSON [#14543](https://redirect.github.com/Automattic/mongoose/issues/14543)
- fix: make hydrate() recursively hydrate virtual populate docs if hydratedPopulatedDocs is set [#14533](https://redirect.github.com/Automattic/mongoose/issues/14533) [#14503](https://redirect.github.com/Automattic/mongoose/issues/14503)
- fix: improve timestamps option handling in bulkWrite [#14546](https://redirect.github.com/Automattic/mongoose/issues/14546) [#14536](https://redirect.github.com/Automattic/mongoose/issues/14536) [sderrow](https://redirect.github.com/sderrow)
- fix(model): make recompileSchema() overwrite existing document array discriminators [#14527](https://redirect.github.com/Automattic/mongoose/issues/14527)
- types(schema): correctly infer Array\ [#14534](https://redirect.github.com/Automattic/mongoose/issues/14534) [#14367](https://redirect.github.com/Automattic/mongoose/issues/14367)
- types(query+populate): apply populate overrides to doc toObject() result [#14525](https://redirect.github.com/Automattic/mongoose/issues/14525) [#14441](https://redirect.github.com/Automattic/mongoose/issues/14441)
- types: add null to select override return type for findOne [#14545](https://redirect.github.com/Automattic/mongoose/issues/14545) [sderrow](https://redirect.github.com/sderrow)
### [`v8.3.2`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#832--2024-04-16)
[Compare Source](https://redirect.github.com/Automattic/mongoose/compare/8.3.1...8.3.2)
\==================
- fix(populate): avoid match function filtering out null values in populate result [#14518](https://redirect.github.com/Automattic/mongoose/issues/14518) [#14494](https://redirect.github.com/Automattic/mongoose/issues/14494)
- types(query): make FilterQuery props resolve to any for generics support [#14510](https://redirect.github.com/Automattic/mongoose/issues/14510) [#14473](https://redirect.github.com/Automattic/mongoose/issues/14473) [#14459](https://redirect.github.com/Automattic/mongoose/issues/14459)
- types(DocumentArray): pass DocType generic to Document for correct toJSON() and toObject() return types [#14526](https://redirect.github.com/Automattic/mongoose/issues/14526) [#14469](https://redirect.github.com/Automattic/mongoose/issues/14469)
- types(models): fix incorrect bulk write options [#14513](https://redirect.github.com/Automattic/mongoose/issues/14513) [emiljanitzek](https://redirect.github.com/emiljanitzek)
- docs: add documentation for calling schema.post() with async function [#14514](https://redirect.github.com/Automattic/mongoose/issues/14514) [#14305](https://redirect.github.com/Automattic/mongoose/issues/14305)
### [`v8.3.1`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#831--2024-04-08)
[Compare Source](https://redirect.github.com/Automattic/mongoose/compare/8.3.0...8.3.1)
\==================
- fix(document): make update minimization unset property rather than setting to null [#14504](https://redirect.github.com/Automattic/mongoose/issues/14504) [#14445](https://redirect.github.com/Automattic/mongoose/issues/14445)
- fix(model): make Model.recompileSchema() also re-apply discriminators [#14500](https://redirect.github.com/Automattic/mongoose/issues/14500) [#14444](https://redirect.github.com/Automattic/mongoose/issues/14444)
- fix(schema): deduplicate idGetter so creating multiple models with same schema doesn't result in multiple id getters [#14492](https://redirect.github.com/Automattic/mongoose/issues/14492)
- fix: update kareem -> 2.6.3 for index.d.ts [#14508](https://redirect.github.com/Automattic/mongoose/issues/14508) [#14497](https://redirect.github.com/Automattic/mongoose/issues/14497)
- fix(mongoose): make setDriver() update mongoose.model() connections and collections [#14505](https://redirect.github.com/Automattic/mongoose/issues/14505)
- types(validation): support function for validator message property, and add support for accessing validator reason [#14499](https://redirect.github.com/Automattic/mongoose/issues/14499) [#14496](https://redirect.github.com/Automattic/mongoose/issues/14496)
- docs: remove typo [#14501](https://redirect.github.com/Automattic/mongoose/issues/14501) [epmartini](https://redirect.github.com/epmartini)
### [`v8.3.0`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#830--2024-04-03)
[Compare Source](https://redirect.github.com/Automattic/mongoose/compare/8.2.4...8.3.0)
\==================
- feat(document): add validateAllPaths option to validate() and validateSync() [#14467](https://redirect.github.com/Automattic/mongoose/issues/14467) [#14414](https://redirect.github.com/Automattic/mongoose/issues/14414)
- feat: pathsToSave option to save() function [#14385](https://redirect.github.com/Automattic/mongoose/issues/14385) [#9583](https://redirect.github.com/Automattic/mongoose/issues/9583)
- feat(query): add options parameter to Query.prototype.sort() [#14375](https://redirect.github.com/Automattic/mongoose/issues/14375) [#14365](https://redirect.github.com/Automattic/mongoose/issues/14365)
- feat: add function SchemaType.prototype.validateAll [#14434](https://redirect.github.com/Automattic/mongoose/issues/14434) [#6910](https://redirect.github.com/Automattic/mongoose/issues/6910)
- fix: handle array schema definitions with of keyword [#14447](https://redirect.github.com/Automattic/mongoose/issues/14447) [#14416](https://redirect.github.com/Automattic/mongoose/issues/14416)
- types: add overwriteMiddlewareResult and skipMiddlewareFunction to types [#14328](https://redirect.github.com/Automattic/mongoose/issues/14328) [#14829](https://redirect.github.com/Automattic/mongoose/issues/14829)
### [`v8.2.4`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#824--2024-03-28)
[Compare Source](https://redirect.github.com/Automattic/mongoose/compare/8.2.3...8.2.4)
\==================
- types(query): bring "getFilter" and "getQuery" in-line with "find" and other types [#14463](https://redirect.github.com/Automattic/mongoose/issues/14463) [noseworthy](https://redirect.github.com/noseworthy)
- types(schema): re-export the defintion for SearchIndexDescription [#14464](https://redirect.github.com/Automattic/mongoose/issues/14464)
- docs: removed unused hook from docs [#14461](https://redirect.github.com/Automattic/mongoose/issues/14461) [bernardarhia](https://redirect.github.com/bernardarhia)
### [`v8.2.3`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#823--2024-03-21)
[Compare Source](https://redirect.github.com/Automattic/mongoose/compare/8.2.2...8.2.3)
\==================
- fix(schema): avoid returning string 'nested' as schematype [#14453](https://redirect.github.com/Automattic/mongoose/issues/14453) [#14443](https://redirect.github.com/Automattic/mongoose/issues/14443) [#14435](https://redirect.github.com/Automattic/mongoose/issues/14435)
- types(schema): add missing search index types [#14449](https://redirect.github.com/Automattic/mongoose/issues/14449) [noseworthy](https://redirect.github.com/noseworthy)
- types: improve the typing of FilterQuery type to prevent it from only getting typed to any [#14436](https://redirect.github.com/Automattic/mongoose/issues/14436) [#14398](https://redirect.github.com/Automattic/mongoose/issues/14398) [#14397](https://redirect.github.com/Automattic/mongoose/issues/14397)
### [`v8.2.2`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#822--2024-03-15)
[Compare Source](https://redirect.github.com/Automattic/mongoose/compare/8.2.1...8.2.2)
\==================
- fix(model): improve update minimizing to only minimize top-level properties in the update [#14437](https://redirect.github.com/Automattic/mongoose/issues/14437) [#14420](https://redirect.github.com/Automattic/mongoose/issues/14420) [#13782](https://redirect.github.com/Automattic/mongoose/issues/13782)
- fix: add Null check in case schema.options\['type']\[0] is undefined [#14431](https://redirect.github.com/Automattic/mongoose/issues/14431) [Atharv-Bobde](https://redirect.github.com/Atharv-Bobde)
- types: consistently infer array of objects in schema as a DocumentArray [#14430](https://redirect.github.com/Automattic/mongoose/issues/14430) [#14367](https://redirect.github.com/Automattic/mongoose/issues/14367)
- types: add TypeScript interface for the new PipelineStage - Vector Search - solving issue [#14428](https://redirect.github.com/Automattic/mongoose/issues/14428) [#14429](https://redirect.github.com/Automattic/mongoose/issues/14429) [jkorach](https://redirect.github.com/jkorach)
- types: add pre and post function types on Query class [#14433](https://redirect.github.com/Automattic/mongoose/issues/14433) [#14432](https://redirect.github.com/Automattic/mongoose/issues/14432) [IICarst](https://redirect.github.com/IICarst)
- types(model): make bulkWrite() types more flexible to account for casting [#14423](https://redirect.github.com/Automattic/mongoose/issues/14423)
- docs: update version support documentation for mongoose 5 & 6 [#14427](https://redirect.github.com/Automattic/mongoose/issues/14427) [hasezoey](https://redirect.github.com/hasezoey)
### [`v8.2.1`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#821--2024-03-04)
[Compare Source](https://redirect.github.com/Automattic/mongoose/compare/8.2.0...8.2.1)
\==================
- fix(document): make $clone avoid converting subdocs into POJOs [#14395](https://redirect.github.com/Automattic/mongoose/issues/14395) [#14353](https://redirect.github.com/Automattic/mongoose/issues/14353)
- fix(connection): avoid unhandled error on createConnection() if on('error') handler registered [#14390](https://redirect.github.com/Automattic/mongoose/issues/14390) [#14377](https://redirect.github.com/Automattic/mongoose/issues/14377)
- fix(schema): avoid applying default write concern to operations that are in a transaction [#14391](https://redirect.github.com/Automattic/mongoose/issues/14391) [#11382](https://redirect.github.com/Automattic/mongoose/issues/11382)
- types(querycursor): correct cursor async iterator type with populate() support [#14384](https://redirect.github.com/Automattic/mongoose/issues/14384) [#14374](https://redirect.github.com/Automattic/mongoose/issues/14374)
- types: missing typescript details on options params of updateMany, updateOne, etc. [#14382](https://redirect.github.com/Automattic/mongoose/issues/14382) [#14379](https://redirect.github.com/Automattic/mongoose/issues/14379) [#14378](https://redirect.github.com/Automattic/mongoose/issues/14378) [FaizBShah](https://redirect.github.com/FaizBShah) [sderrow](https://redirect.github.com/sderrow)
- types: allow Record\ as valid query select argument [#14371](https://redirect.github.com/Automattic/mongoose/issues/14371) [sderrow](https://redirect.github.com/sderrow)
### [`v8.2.0`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#820--2024-02-22)
[Compare Source](https://redirect.github.com/Automattic/mongoose/compare/8.1.3...8.2.0)
\==================
- feat(model): add recompileSchema() function to models to allow applying schema changes after compiling [#14306](https://redirect.github.com/Automattic/mongoose/issues/14306) [#14296](https://redirect.github.com/Automattic/mongoose/issues/14296)
- feat: add middleware for bulkWrite() and createCollection() [#14358](https://redirect.github.com/Automattic/mongoose/issues/14358) [#14263](https://redirect.github.com/Automattic/mongoose/issues/14263) [#7893](https://redirect.github.com/Automattic/mongoose/issues/7893)
- feat(model): add `hydratedPopulatedDocs` option to make hydrate recursively hydrate populated docs [#14352](https://redirect.github.com/Automattic/mongoose/issues/14352) [#4727](https://redirect.github.com/Automattic/mongoose/issues/4727)
- feat(connection): add withSession helper [#14339](https://redirect.github.com/Automattic/mongoose/issues/14339) [#14330](https://redirect.github.com/Automattic/mongoose/issues/14330)
### [`v8.1.3`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#813--2024-02-16)
[Compare Source](https://redirect.github.com/Automattic/mongoose/compare/8.1.2...8.1.3)
\==================
- fix: avoid corrupting $set-ed arrays when transaction error occurs [#14346](https://redirect.github.com/Automattic/mongoose/issues/14346) [#14340](https://redirect.github.com/Automattic/mongoose/issues/14340)
- fix(populate): handle ref() functions that return a model instance [#14343](https://redirect.github.com/Automattic/mongoose/issues/14343) [#14249](https://redirect.github.com/Automattic/mongoose/issues/14249)
- fix: insert version key when using insertMany even if `toObject.versionKey` set to false [#14344](https://redirect.github.com/Automattic/mongoose/issues/14344)
- fix(cursor): make aggregation cursor support transform option to match query cursor [#14348](https://redirect.github.com/Automattic/mongoose/issues/14348) [#14331](https://redirect.github.com/Automattic/mongoose/issues/14331)
- docs(document): clarify that transform function option applies to subdocs [#13757](https://redirect.github.com/Automattic/mongoose/issues/13757)
### [`v8.1.2`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#812--2024-02-08)
[Compare Source](https://redirect.github.com/Automattic/mongoose/compare/8.1.1...8.1.2)
\==================
- fix: include virtuals in document array toString() output if toObject.virtuals set [#14335](https://redirect.github.com/Automattic/mongoose/issues/14335) [#14315](https://redirect.github.com/Automattic/mongoose/issues/14315)
- fix(document): handle setting nested path to spread doc with extra properties [#14287](https://redirect.github.com/Automattic/mongoose/issues/14287) [#14269](https://redirect.github.com/Automattic/mongoose/issues/14269)
- fix(populate): call setter on virtual populated path with populated doc instead of undefined [#14314](https://redirect.github.com/Automattic/mongoose/issues/14314)
- fix(QueryCursor): remove callback parameter of AggregationCursor and QueryCursor [#14299](https://redirect.github.com/Automattic/mongoose/issues/14299) [DevooKim](https://redirect.github.com/DevooKim)
- types: add typescript support for arbitrary fields for the options parameter of Model functions which are of type MongooseQueryOptions [#14342](https://redirect.github.com/Automattic/mongoose/issues/14342) [#14341](https://redirect.github.com/Automattic/mongoose/issues/14341) [FaizBShah](https://redirect.github.com/FaizBShah)
- types(model): correct return type for findOneAndUpdate with includeResultMetadata and lean set [#14336](https://redirect.github.com/Automattic/mongoose/issues/14336) [#14303](https://redirect.github.com/Automattic/mongoose/issues/14303)
- types(connection): add type definition for `createCollections()` [#14295](https://redirect.github.com/Automattic/mongoose/issues/14295) [#14279](https://redirect.github.com/Automattic/mongoose/issues/14279)
- docs(timestamps): clarify that replaceOne() and findOneAndReplace() overwrite timestamps [#14337](https://redirect.github.com/Automattic/mongoose/issues/14337) [#14309](https://redirect.github.com/Automattic/mongoose/issues/14309)
### [`v8.1.1`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#811--2024-01-24)
[Compare Source](https://redirect.github.com/Automattic/mongoose/compare/8.1.0...8.1.1)
\==================
- fix(model): throw readable error when calling Model() with a string instead of model() [#14288](https://redirect.github.com/Automattic/mongoose/issues/14288) [#14281](https://redirect.github.com/Automattic/mongoose/issues/14281)
- fix(document): handle setting nested path to spread doc with extra properties [#14287](https://redirect.github.com/Automattic/mongoose/issues/14287) [#14269](https://redirect.github.com/Automattic/mongoose/issues/14269)
- types(query): add back context and setDefaultsOnInsert as Mongoose-specific query options [#14284](https://redirect.github.com/Automattic/mongoose/issues/14284) [#14282](https://redirect.github.com/Automattic/mongoose/issues/14282)
- types(query): add missing runValidators back to MongooseQueryOptions [#14278](https://redirect.github.com/Automattic/mongoose/issues/14278) [#14275](https://redirect.github.com/Automattic/mongoose/issues/14275)
### [`v8.1.0`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#810--2024-01-16)
[Compare Source](https://redirect.github.com/Automattic/mongoose/compare/8.0.4...8.1.0)
\==================
- feat: upgrade MongoDB driver -> 6.3.0 [#14241](https://redirect.github.com/Automattic/mongoose/issues/14241) [#14189](https://redirect.github.com/Automattic/mongoose/issues/14189) [#14108](https://redirect.github.com/Automattic/mongoose/issues/14108) [#14104](https://redirect.github.com/Automattic/mongoose/issues/14104)
- feat: add Atlas search index helpers to Models and Schemas [#14251](https://redirect.github.com/Automattic/mongoose/issues/14251) [#14232](https://redirect.github.com/Automattic/mongoose/issues/14232)
- feat(connection): add listCollections() helper to connections [#14257](https://redirect.github.com/Automattic/mongoose/issues/14257)
- feat(schematype): merge rather than overwrite default schematype validators [#14124](https://redirect.github.com/Automattic/mongoose/issues/14124) [#14070](https://redirect.github.com/Automattic/mongoose/issues/14070)
- feat(types): support type hints in InferSchemaType [#14008](https://redirect.github.com/Automattic/mongoose/issues/14008) [JavaScriptBach](https://redirect.github.com/JavaScriptBach)
### [`v8.0.4`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#804--2024-01-08)
[Compare Source](https://redirect.github.com/Automattic/mongoose/compare/8.0.3...8.0.4)
\==================
- fix(update): set CastError path to full path if casting update fails [#14161](https://redirect.github.com/Automattic/mongoose/issues/14161) [#14114](https://redirect.github.com/Automattic/mongoose/issues/14114)
- fix: cast error when there is an elemMatch in the and clause [#14171](https://redirect.github.com/Automattic/mongoose/issues/14171) [tosaka-n](https://redirect.github.com/tosaka-n)
- fix: allow defining index on base model that applies to all discriminators [#14176](https://redirect.github.com/Automattic/mongoose/issues/14176) [peplin](https://redirect.github.com/peplin)
- fix(model): deep clone bulkWrite() updateOne arguments to avoid mutating documents in update [#14197](https://redirect.github.com/Automattic/mongoose/issues/14197) [#14164](https://redirect.github.com/Automattic/mongoose/issues/14164)
- fix(populate): handle deselecting \_id with array of fields in populate() [#14242](https://redirect.github.com/Automattic/mongoose/issues/14242) [#14231](https://redirect.github.com/Automattic/mongoose/issues/14231)
- types(model+query): use stricter typings for updateX(), replaceOne(),deleteX() Model functions [#14228](https://redirect.github.com/Automattic/mongoose/issues/14228) [#14204](https://redirect.github.com/Automattic/mongoose/issues/14204)
- types: fix return types for findByIdAndDelete overrides [#14196](https://redirect.github.com/Automattic/mongoose/issues/14196) [#14190](https://redirect.github.com/Automattic/mongoose/issues/14190)
- types(schema): add missing omit() method [#14235](https://redirect.github.com/Automattic/mongoose/issues/14235) [amitbeck](https://redirect.github.com/amitbeck)
- types(model): add missing strict property to bulkWrite() top level options [#14239](https://redirect.github.com/Automattic/mongoose/issues/14239)
- docs(compatibility): add note that Mongoose 5.13 is fully compatible with MongoDB server 5 [#14230](https://redirect.github.com/Automattic/mongoose/issues/14230) [#14149](https://redirect.github.com/Automattic/mongoose/issues/14149)
- docs: add shared schemas guide [#14211](https://redirect.github.com/Automattic/mongoose/issues/14211)
- docs: update TLS/SSL guide for Mongoose v8 - MongoDB v6 driver deprecations [#14170](https://redirect.github.com/Automattic/mongoose/issues/14170) [andylwelch](https://redirect.github.com/andylwelch)
- docs: update findOneAndUpdate tutorial to use includeResultMetadata [#14208](https://redirect.github.com/Automattic/mongoose/issues/14208) [#14207](https://redirect.github.com/Automattic/mongoose/issues/14207)
- docs: clarify disabling \_id on subdocs [#14195](https://redirect.github.com/Automattic/mongoose/issues/14195) [#14194](https://redirect.github.com/Automattic/mongoose/issues/14194)
### [`v8.0.3`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#803--2023-12-07)
[Compare Source](https://redirect.github.com/Automattic/mongoose/compare/8.0.2...8.0.3)
\==================
- fix(schema): avoid creating unnecessary clone of schematype in nested array so nested document arrays use correct constructor [#14128](https://redirect.github.com/Automattic/mongoose/issues/14128) [#14101](https://redirect.github.com/Automattic/mongoose/issues/14101)
- docs(connections): add example of registering connection event handlers [#14150](https://redirect.github.com/Automattic/mongoose/issues/14150)
- docs(populate): add example of using `refPath` and `ref` functions
Configuration
📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
[ ] If you want to rebase/retry this PR, check this box
This PR contains the following updates:
6.12.3
->8.8.0
Release Notes
Automattic/mongoose (mongoose)
### [`v8.8.0`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#880--2024-10-31) [Compare Source](https://redirect.github.com/Automattic/mongoose/compare/8.7.3...8.8.0) \================== - feat: upgrade mongodb -> ~6.10 [#14991](https://redirect.github.com/Automattic/mongoose/issues/14991) [#14877](https://redirect.github.com/Automattic/mongoose/issues/14877) - feat(query): add schemaLevelProjections option to query to disable schema-level select: false [#14986](https://redirect.github.com/Automattic/mongoose/issues/14986) [#11474](https://redirect.github.com/Automattic/mongoose/issues/11474) - feat: allow defining virtuals on arrays, not just array elements [#14955](https://redirect.github.com/Automattic/mongoose/issues/14955) [#2326](https://redirect.github.com/Automattic/mongoose/issues/2326) - feat(model): add applyTimestamps() function to apply all schema timestamps, including subdocuments, to a given POJO [#14943](https://redirect.github.com/Automattic/mongoose/issues/14943) [#14698](https://redirect.github.com/Automattic/mongoose/issues/14698) - feat(model): add hideIndexes option to syncIndexes() and cleanIndexes() [#14987](https://redirect.github.com/Automattic/mongoose/issues/14987) [#14868](https://redirect.github.com/Automattic/mongoose/issues/14868) - fix(query): make sanitizeFilter disable implicit $in [#14985](https://redirect.github.com/Automattic/mongoose/issues/14985) [#14657](https://redirect.github.com/Automattic/mongoose/issues/14657) - fix(model): avoid unhandled error if createIndex() throws a sync error [#14995](https://redirect.github.com/Automattic/mongoose/issues/14995) - fix(model): avoid throwing TypeError if bulkSave()'s bulkWrite() fails with a non-BulkWriteError [#14993](https://redirect.github.com/Automattic/mongoose/issues/14993) - types: added toJSON:flattenObjectIds effect [#14989](https://redirect.github.com/Automattic/mongoose/issues/14989) - types: add `__v` to lean() result type and ModifyResult [#14990](https://redirect.github.com/Automattic/mongoose/issues/14990) [#12959](https://redirect.github.com/Automattic/mongoose/issues/12959) - types: use globalThis instead of global for NativeDate [#14992](https://redirect.github.com/Automattic/mongoose/issues/14992) [#14988](https://redirect.github.com/Automattic/mongoose/issues/14988) - docs(change-streams): fix markdown syntax highlighting for script output example [#14994](https://redirect.github.com/Automattic/mongoose/issues/14994) ### [`v8.7.3`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#873--2024-10-25) [Compare Source](https://redirect.github.com/Automattic/mongoose/compare/8.7.2...8.7.3) \================== - fix(cursor): close underlying query cursor when calling destroy() [#14982](https://redirect.github.com/Automattic/mongoose/issues/14982) [#14966](https://redirect.github.com/Automattic/mongoose/issues/14966) - types: add JSONSerialized helper that can convert HydratedDocument to JSON output type [#14981](https://redirect.github.com/Automattic/mongoose/issues/14981) [#14451](https://redirect.github.com/Automattic/mongoose/issues/14451) - types(model): convert InsertManyResult to interface and remove unnecessary insertedIds override [#14977](https://redirect.github.com/Automattic/mongoose/issues/14977) - types(connection): add missing sanitizeFilter option [#14975](https://redirect.github.com/Automattic/mongoose/issues/14975) - types: improve goto definition for inferred schema definitions [#14968](https://redirect.github.com/Automattic/mongoose/issues/14968) [forivall](https://redirect.github.com/forivall) - docs(migration-guide-v7): correct link to the section "Id Setter" [#14973](https://redirect.github.com/Automattic/mongoose/issues/14973) [rb-ntnx](https://redirect.github.com/rb-ntnx) ### [`v8.7.2`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#872--2024-10-17) [Compare Source](https://redirect.github.com/Automattic/mongoose/compare/8.7.1...8.7.2) \================== - fix(document): recursively clear modified subpaths when setting deeply nested subdoc to null [#14963](https://redirect.github.com/Automattic/mongoose/issues/14963) [#14952](https://redirect.github.com/Automattic/mongoose/issues/14952) - fix(populate): handle array of ids with parent refPath [#14965](https://redirect.github.com/Automattic/mongoose/issues/14965) - types: make Buffers into mongodb.Binary in lean result type to match runtime behavior [#14967](https://redirect.github.com/Automattic/mongoose/issues/14967) - types: correct schema type inference when using nested typeKey like type: { type: String } [#14956](https://redirect.github.com/Automattic/mongoose/issues/14956) [#14950](https://redirect.github.com/Automattic/mongoose/issues/14950) - types: re-export DeleteResult and UpdateResult from MongoDB Node.js driver [#14947](https://redirect.github.com/Automattic/mongoose/issues/14947) [#14946](https://redirect.github.com/Automattic/mongoose/issues/14946) - docs(documents): add section on setting deeply nested properties, including warning about nullish coalescing assignment [#14972](https://redirect.github.com/Automattic/mongoose/issues/14972) - docs(model): add more info on acknowledged: false, specifically that Mongoose may return that if the update was empty [#14957](https://redirect.github.com/Automattic/mongoose/issues/14957) ### [`v8.7.1`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#871--2024-10-09) [Compare Source](https://redirect.github.com/Automattic/mongoose/compare/8.7.0...8.7.1) \================== - fix: set flattenObjectIds to false when calling toObject() for internal purposes [#14938](https://redirect.github.com/Automattic/mongoose/issues/14938) - fix: add mongodb 8 to test matrix [#14937](https://redirect.github.com/Automattic/mongoose/issues/14937) - fix: handle buffers stored in MongoDB as EJSON representation with { $binary } [#14932](https://redirect.github.com/Automattic/mongoose/issues/14932) - docs: indicate that Mongoose 8.7 is required for full MongoDB 8 support [#14937](https://redirect.github.com/Automattic/mongoose/issues/14937) ### [`v8.7.0`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#870--2024-09-27) [Compare Source](https://redirect.github.com/Automattic/mongoose/compare/8.6.4...8.7.0) \================== - feat(model): add Model.applyVirtuals() to apply virtuals to a POJO [#14905](https://redirect.github.com/Automattic/mongoose/issues/14905) [#14818](https://redirect.github.com/Automattic/mongoose/issues/14818) - feat: upgrade mongodb -> 6.9.0 [#14914](https://redirect.github.com/Automattic/mongoose/issues/14914) - feat(query): cast $rename to string [#14887](https://redirect.github.com/Automattic/mongoose/issues/14887) [#3027](https://redirect.github.com/Automattic/mongoose/issues/3027) - feat(SchemaType): add getEmbeddedSchemaType() method to SchemaTypes [#14880](https://redirect.github.com/Automattic/mongoose/issues/14880) [#8389](https://redirect.github.com/Automattic/mongoose/issues/8389) - fix(model): throw MongooseBulkSaveIncompleteError if bulkSave() didn't completely succeed [#14884](https://redirect.github.com/Automattic/mongoose/issues/14884) [#14763](https://redirect.github.com/Automattic/mongoose/issues/14763) - fix(connection): avoid returning readyState = connected if connection state is stale [#14812](https://redirect.github.com/Automattic/mongoose/issues/14812) [#14727](https://redirect.github.com/Automattic/mongoose/issues/14727) - fix: depopulate if push() or addToSet() with an ObjectId on a populated array [#14883](https://redirect.github.com/Automattic/mongoose/issues/14883) [#1635](https://redirect.github.com/Automattic/mongoose/issues/1635) - types: make \__v a number, only set \__v on top-level documents [#14892](https://redirect.github.com/Automattic/mongoose/issues/14892) ### [`v8.6.4`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#864--2024-09-26) [Compare Source](https://redirect.github.com/Automattic/mongoose/compare/8.6.3...8.6.4) \================== - fix(document): avoid massive perf degradation when saving new doc with 10 level deep subdocs [#14910](https://redirect.github.com/Automattic/mongoose/issues/14910) [#14897](https://redirect.github.com/Automattic/mongoose/issues/14897) - fix(model): skip applying static hooks by default if static name conflicts with aggregate middleware [#14904](https://redirect.github.com/Automattic/mongoose/issues/14904) [dragontaek-lee](https://redirect.github.com/dragontaek-lee) - fix(model): filter applying static hooks by default if static name conflicts with mongoose middleware [#14908](https://redirect.github.com/Automattic/mongoose/issues/14908) [dragontaek-lee](https://redirect.github.com/dragontaek-lee) ### [`v8.6.3`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#863--2024-09-17) [Compare Source](https://redirect.github.com/Automattic/mongoose/compare/8.6.2...8.6.3) \================== - fix: make getters convert uuid to string when calling toObject() and toJSON() [#14890](https://redirect.github.com/Automattic/mongoose/issues/14890) [#14869](https://redirect.github.com/Automattic/mongoose/issues/14869) - fix: fix missing Aggregate re-exports for ESM [#14886](https://redirect.github.com/Automattic/mongoose/issues/14886) [wongsean](https://redirect.github.com/wongsean) - types(document): add generic param to depopulate() to allow updating properties [#14891](https://redirect.github.com/Automattic/mongoose/issues/14891) [#14876](https://redirect.github.com/Automattic/mongoose/issues/14876) ### [`v8.6.2`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#862--2024-09-11) [Compare Source](https://redirect.github.com/Automattic/mongoose/compare/8.6.1...8.6.2) \================== - fix: make set merge deeply nested objects [#14870](https://redirect.github.com/Automattic/mongoose/issues/14870) [#14861](https://redirect.github.com/Automattic/mongoose/issues/14861) [ianHeydoc](https://redirect.github.com/ianHeydoc) - types: allow arbitrary keys in query filters again (revert [#14764](https://redirect.github.com/Automattic/mongoose/issues/14764)) [#14874](https://redirect.github.com/Automattic/mongoose/issues/14874) [#14863](https://redirect.github.com/Automattic/mongoose/issues/14863) [#14862](https://redirect.github.com/Automattic/mongoose/issues/14862) [#14842](https://redirect.github.com/Automattic/mongoose/issues/14842) - types: make SchemaType static setters property accessible in TypeScript [#14881](https://redirect.github.com/Automattic/mongoose/issues/14881) [#14879](https://redirect.github.com/Automattic/mongoose/issues/14879) - type(inferrawdoctype): infer Date types as JS dates rather than Mongoose SchemaType Date [#14882](https://redirect.github.com/Automattic/mongoose/issues/14882) [#14839](https://redirect.github.com/Automattic/mongoose/issues/14839) ### [`v8.6.1`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#861--2024-09-03) [Compare Source](https://redirect.github.com/Automattic/mongoose/compare/8.6.0...8.6.1) \================== - fix(document): avoid unnecessary clone() in applyGetters() that was preventing getters from running on 3-level deep subdocuments [#14844](https://redirect.github.com/Automattic/mongoose/issues/14844) [#14840](https://redirect.github.com/Automattic/mongoose/issues/14840) [#14835](https://redirect.github.com/Automattic/mongoose/issues/14835) - fix(model): throw error if bulkSave() did not insert or update any documents [#14837](https://redirect.github.com/Automattic/mongoose/issues/14837) [#14763](https://redirect.github.com/Automattic/mongoose/issues/14763) - fix(cursor): throw error in ChangeStream constructor if changeStreamThunk() throws a sync error [#14846](https://redirect.github.com/Automattic/mongoose/issues/14846) - types(query): add $expr to RootQuerySelector [#14845](https://redirect.github.com/Automattic/mongoose/issues/14845) - docs: update populate.md to fix missing match: { } [#14847](https://redirect.github.com/Automattic/mongoose/issues/14847) [makhoulshbeeb](https://redirect.github.com/makhoulshbeeb) ### [`v8.6.0`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#860--2024-08-28) [Compare Source](https://redirect.github.com/Automattic/mongoose/compare/8.5.5...8.6.0) \================== - feat: upgrade mongodb -> 6.8.0, handle throwing error on closed cursor in Mongoose with `MongooseError` instead of `MongoCursorExhaustedError` [#14813](https://redirect.github.com/Automattic/mongoose/issues/14813) - feat(model+query): support options parameter for distinct() [#14772](https://redirect.github.com/Automattic/mongoose/issues/14772) [#8006](https://redirect.github.com/Automattic/mongoose/issues/8006) - feat(QueryCursor): add getDriverCursor() function that returns the raw driver cursor [#14745](https://redirect.github.com/Automattic/mongoose/issues/14745) - types: change query selector to disallow unknown top-level keys by default [#14764](https://redirect.github.com/Automattic/mongoose/issues/14764) [alex-statsig](https://redirect.github.com/alex-statsig) - types: make toObject() and toJSON() not generic by default to avoid type widening [#14819](https://redirect.github.com/Automattic/mongoose/issues/14819) [#12883](https://redirect.github.com/Automattic/mongoose/issues/12883) - types: avoid automatically inferring lean result type when assigning to explicitly typed variable [#14734](https://redirect.github.com/Automattic/mongoose/issues/14734) ### [`v8.5.5`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#855--2024-08-28) [Compare Source](https://redirect.github.com/Automattic/mongoose/compare/8.5.4...8.5.5) \================== - fix(populate): fix a couple of other places where Mongoose gets the document's \_id with getters [#14833](https://redirect.github.com/Automattic/mongoose/issues/14833) [#14827](https://redirect.github.com/Automattic/mongoose/issues/14827) [#14759](https://redirect.github.com/Automattic/mongoose/issues/14759) - fix(discriminator): shallow clone Schema.prototype.obj before merging schemas to avoid modifying original obj [#14821](https://redirect.github.com/Automattic/mongoose/issues/14821) - types: fix schema type based on timestamps schema options value [#14829](https://redirect.github.com/Automattic/mongoose/issues/14829) [#14825](https://redirect.github.com/Automattic/mongoose/issues/14825) [ark23CIS](https://redirect.github.com/ark23CIS) ### [`v8.5.4`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#854--2024-08-23) [Compare Source](https://redirect.github.com/Automattic/mongoose/compare/8.5.3...8.5.4) \================== - fix: add empty string check for collection name passed [#14806](https://redirect.github.com/Automattic/mongoose/issues/14806) [Shubham2552](https://redirect.github.com/Shubham2552) - docs(model): add 'throw' as valid strict value for bulkWrite() and add some more clarification on throwOnValidationError [#14809](https://redirect.github.com/Automattic/mongoose/issues/14809) ### [`v8.5.3`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#853--2024-08-13) [Compare Source](https://redirect.github.com/Automattic/mongoose/compare/8.5.2...8.5.3) \================== - fix(document): call required functions on subdocuments underneath nested paths with correct context [#14801](https://redirect.github.com/Automattic/mongoose/issues/14801) [#14788](https://redirect.github.com/Automattic/mongoose/issues/14788) - fix(populate): avoid throwing error when no result and `lean()` set [#14799](https://redirect.github.com/Automattic/mongoose/issues/14799) [#14794](https://redirect.github.com/Automattic/mongoose/issues/14794) [#14759](https://redirect.github.com/Automattic/mongoose/issues/14759) [MohOraby](https://redirect.github.com/MohOraby) - fix(document): apply virtuals to subdocuments if parent schema has virtuals: true for backwards compatibility [#14774](https://redirect.github.com/Automattic/mongoose/issues/14774) [#14771](https://redirect.github.com/Automattic/mongoose/issues/14771) [#14623](https://redirect.github.com/Automattic/mongoose/issues/14623) [#14394](https://redirect.github.com/Automattic/mongoose/issues/14394) - types: make HydratedSingleSubdocument and HydratedArraySubdocument merge types instead of using & [#14800](https://redirect.github.com/Automattic/mongoose/issues/14800) [#14793](https://redirect.github.com/Automattic/mongoose/issues/14793) - types: support schema type inference based on schema options timestamps as well [#14773](https://redirect.github.com/Automattic/mongoose/issues/14773) [#13215](https://redirect.github.com/Automattic/mongoose/issues/13215) [ark23CIS](https://redirect.github.com/ark23CIS) - types(cursor): indicate that cursor.next() can return null [#14798](https://redirect.github.com/Automattic/mongoose/issues/14798) [#14787](https://redirect.github.com/Automattic/mongoose/issues/14787) - types: allow mongoose.connection.db to be undefined [#14797](https://redirect.github.com/Automattic/mongoose/issues/14797) [#14789](https://redirect.github.com/Automattic/mongoose/issues/14789) - docs: add schema type widening advice [#14790](https://redirect.github.com/Automattic/mongoose/issues/14790) [JstnMcBrd](https://redirect.github.com/JstnMcBrd) ### [`v8.5.2`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#852--2024-07-30) [Compare Source](https://redirect.github.com/Automattic/mongoose/compare/8.5.1...8.5.2) \================== - perf(clone): avoid further unnecessary checks if cloning a primitive value [#14762](https://redirect.github.com/Automattic/mongoose/issues/14762) [#14394](https://redirect.github.com/Automattic/mongoose/issues/14394) - fix: allow setting document array default to null [#14769](https://redirect.github.com/Automattic/mongoose/issues/14769) [#14717](https://redirect.github.com/Automattic/mongoose/issues/14717) [#6691](https://redirect.github.com/Automattic/mongoose/issues/6691) - fix(model): support session: null option for save() to opt out of automatic session option with transactionAsyncLocalStorage [#14744](https://redirect.github.com/Automattic/mongoose/issues/14744) [#14736](https://redirect.github.com/Automattic/mongoose/issues/14736) - fix(model+document): avoid depopulating manually populated doc as getter value [#14760](https://redirect.github.com/Automattic/mongoose/issues/14760) [#14759](https://redirect.github.com/Automattic/mongoose/issues/14759) - fix: correct shardkey access in buildBulkWriteOps [#14753](https://redirect.github.com/Automattic/mongoose/issues/14753) [#14752](https://redirect.github.com/Automattic/mongoose/issues/14752) [adf0nt3s](https://redirect.github.com/adf0nt3s) - fix(query): handle casting $switch in $expr [#14755](https://redirect.github.com/Automattic/mongoose/issues/14755) [#14751](https://redirect.github.com/Automattic/mongoose/issues/14751) - types: allow calling SchemaType.cast() without parent and init parameters [#14756](https://redirect.github.com/Automattic/mongoose/issues/14756) [#14748](https://redirect.github.com/Automattic/mongoose/issues/14748) [#9076](https://redirect.github.com/Automattic/mongoose/issues/9076) - docs: fix a wrong example in v6 migration guide [#14758](https://redirect.github.com/Automattic/mongoose/issues/14758) [abdelrahman-elkady](https://redirect.github.com/abdelrahman-elkady) ### [`v8.5.1`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#851--2024-07-12) [Compare Source](https://redirect.github.com/Automattic/mongoose/compare/8.5.0...8.5.1) \================== - perf(model): performance improvements for insertMany() [#14724](https://redirect.github.com/Automattic/mongoose/issues/14724) - fix(model): avoid leaving subdoc defaults on top-level doc when setting subdocument to same value [#14728](https://redirect.github.com/Automattic/mongoose/issues/14728) [#14722](https://redirect.github.com/Automattic/mongoose/issues/14722) - fix(model): handle transactionAsyncLocalStorage option with insertMany() [#14743](https://redirect.github.com/Automattic/mongoose/issues/14743) - types: make \_id required on Document type [#14735](https://redirect.github.com/Automattic/mongoose/issues/14735) [#14660](https://redirect.github.com/Automattic/mongoose/issues/14660) - types: fix ChangeStream.close to return a PromiseConfiguration
📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.