Automattic/mongoose (mongoose)
### [`v6.11.3`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#6113--2023-07-11)
[Compare Source](https://redirect.github.com/Automattic/mongoose/compare/6.11.2...6.11.3)
\===================
- fix: avoid prototype pollution on init
- fix(schema): correctly handle uuids with populate() [#13317](https://redirect.github.com/Automattic/mongoose/issues/13317) [#13595](https://redirect.github.com/Automattic/mongoose/issues/13595)
### [`v6.11.2`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#6112--2023-06-08)
[Compare Source](https://redirect.github.com/Automattic/mongoose/compare/6.11.1...6.11.2)
\===================
- fix(cursor): allow find middleware to modify query cursor options [#13476](https://redirect.github.com/Automattic/mongoose/issues/13476) [#13453](https://redirect.github.com/Automattic/mongoose/issues/13453) [#13435](https://redirect.github.com/Automattic/mongoose/issues/13435)
### [`v6.11.1`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#6111--2023-05-08)
[Compare Source](https://redirect.github.com/Automattic/mongoose/compare/6.11.0...6.11.1)
\===================
- fix(query): apply schema-level paths before calculating projection for findOneAndUpdate() [#13348](https://redirect.github.com/Automattic/mongoose/issues/13348) [#13340](https://redirect.github.com/Automattic/mongoose/issues/13340)
- fix: add SUPPRESS_JEST_WARNINGS environment variable to hide jest warnings [#13384](https://redirect.github.com/Automattic/mongoose/issues/13384) [#13373](https://redirect.github.com/Automattic/mongoose/issues/13373)
- types(model): allow overwriting expected param type for bulkWrite() [#13292](https://redirect.github.com/Automattic/mongoose/issues/13292) [hasezoey](https://redirect.github.com/hasezoey)
### [`v6.11.0`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#6110--2023-05-01)
[Compare Source](https://redirect.github.com/Automattic/mongoose/compare/6.10.5...6.11.0)
\===================
- feat: upgrade to mongodb 4.16.0 for Deno+Atlas connection fix [#13337](https://redirect.github.com/Automattic/mongoose/issues/13337) [#13075](https://redirect.github.com/Automattic/mongoose/issues/13075)
- perf: speed up creating maps of subdocuments [#13280](https://redirect.github.com/Automattic/mongoose/issues/13280) [#13191](https://redirect.github.com/Automattic/mongoose/issues/13191) [#13271](https://redirect.github.com/Automattic/mongoose/issues/13271)
- fix(query): set ObjectParameterError if calling findOneAndX() with filter as non-object [#13338](https://redirect.github.com/Automattic/mongoose/issues/13338)
- fix(document): merge Document $inc calls instead of overwriting [#13322](https://redirect.github.com/Automattic/mongoose/issues/13322)
- fix(update): handle casting doubly nested arrays with $pullAll [#13285](https://redirect.github.com/Automattic/mongoose/issues/13285)
- docs: backport documentation versioning changes to 6.x [#13253](https://redirect.github.com/Automattic/mongoose/issues/13253) [#13190](https://redirect.github.com/Automattic/mongoose/issues/13190) [hasezoey](https://redirect.github.com/hasezoey)
### [`v6.10.5`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#6105--2023-04-06)
[Compare Source](https://redirect.github.com/Automattic/mongoose/compare/6.10.4...6.10.5)
\===================
- perf(document): avoid unnecessary loops, conditionals, string manipulation on Document.prototype.get() for 10x speedup on top-level properties [#12953](https://redirect.github.com/Automattic/mongoose/issues/12953)
- fix(model): execute valid write operations if calling bulkWrite() with ordered: false [#13218](https://redirect.github.com/Automattic/mongoose/issues/13218) [#13176](https://redirect.github.com/Automattic/mongoose/issues/13176)
- fix(array): pass-through all parameters [#13202](https://redirect.github.com/Automattic/mongoose/issues/13202) [#13201](https://redirect.github.com/Automattic/mongoose/issues/13201) [hasezoey](https://redirect.github.com/hasezoey)
- fix: improve error message when sorting by empty string [#13249](https://redirect.github.com/Automattic/mongoose/issues/13249) [#10182](https://redirect.github.com/Automattic/mongoose/issues/10182)
- docs: add version support and check version docs [#13251](https://redirect.github.com/Automattic/mongoose/issues/13251) [#13193](https://redirect.github.com/Automattic/mongoose/issues/13193)
### [`v6.10.4`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#6104--2023-03-21)
[Compare Source](https://redirect.github.com/Automattic/mongoose/compare/6.10.3...6.10.4)
\===================
- fix(document): apply setters on resulting value when calling Document.prototype.$inc() [#13178](https://redirect.github.com/Automattic/mongoose/issues/13178) [#13158](https://redirect.github.com/Automattic/mongoose/issues/13158)
- fix(model): add results property to unordered insertMany() to make it easy to identify exactly which documents were inserted [#13163](https://redirect.github.com/Automattic/mongoose/issues/13163) [#12791](https://redirect.github.com/Automattic/mongoose/issues/12791)
- docs(guide+schematypes): add UUID to schematypes guide [#13184](https://redirect.github.com/Automattic/mongoose/issues/13184)
### [`v6.10.3`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#6103--2023-03-13)
[Compare Source](https://redirect.github.com/Automattic/mongoose/compare/6.10.2...6.10.3)
\===================
- fix(connection): add stub implementation of doClose to base connection class [#13157](https://redirect.github.com/Automattic/mongoose/issues/13157)
- fix(types): add cursor.eachAsync index parameter [#13162](https://redirect.github.com/Automattic/mongoose/issues/13162) [#13153](https://redirect.github.com/Automattic/mongoose/issues/13153) [hasezoey](https://redirect.github.com/hasezoey)
- docs: fix 6.x docs sidebar links [#13147](https://redirect.github.com/Automattic/mongoose/issues/13147) [#13144](https://redirect.github.com/Automattic/mongoose/issues/13144) [hasezoey](https://redirect.github.com/hasezoey)
- docs(validation): clarify that validation runs as first pre(save) middleware [#13062](https://redirect.github.com/Automattic/mongoose/issues/13062)
### [`v6.10.2`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#6102--2023-03-07)
[Compare Source](https://redirect.github.com/Automattic/mongoose/compare/6.10.1...6.10.2)
\===================
- fix(document): avoid setting array default if document array projected out by sibling projection [#13135](https://redirect.github.com/Automattic/mongoose/issues/13135) [#13043](https://redirect.github.com/Automattic/mongoose/issues/13043) [#13003](https://redirect.github.com/Automattic/mongoose/issues/13003)
- fix(documentarray): set correct document array path if making map of document arrays [#13133](https://redirect.github.com/Automattic/mongoose/issues/13133)
- fix: undo accidental change to `engines` in `package.json` [#13124](https://redirect.github.com/Automattic/mongoose/issues/13124) [lorand-horvath](https://redirect.github.com/lorand-horvath)
- docs: quick improvement to Model.init() docs [#13054](https://redirect.github.com/Automattic/mongoose/issues/13054)
### [`v6.10.1`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#6101--2023-03-03)
[Compare Source](https://redirect.github.com/Automattic/mongoose/compare/6.10.0...6.10.1)
\===================
- fix: avoid removing empty query filters in `$and` and `$or` [#13086](https://redirect.github.com/Automattic/mongoose/issues/13086) [#12898](https://redirect.github.com/Automattic/mongoose/issues/12898)
- fix(schematype): fixed validation for required UUID field [#13018](https://redirect.github.com/Automattic/mongoose/issues/13018) [lpizzinidev](https://redirect.github.com/lpizzinidev)
- fix(types): add missing Paths generic param to `Model.populate()` [#13070](https://redirect.github.com/Automattic/mongoose/issues/13070)
- docs(migrating_to\_6): added info about removal of reconnectTries and reconnectInterval options [#13083](https://redirect.github.com/Automattic/mongoose/issues/13083) [lpizzinidev](https://redirect.github.com/lpizzinidev)
- docs: fix code in headers for migrating_to\_5 [#13077](https://redirect.github.com/Automattic/mongoose/issues/13077) [hasezoey](https://redirect.github.com/hasezoey)
- docs: backport misc documentation changes into 6.x [#13091](https://redirect.github.com/Automattic/mongoose/issues/13091) [hasezoey](https://redirect.github.com/hasezoey)
### [`v6.10.0`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#6100--2023-02-22)
[Compare Source](https://redirect.github.com/Automattic/mongoose/compare/6.9.3...6.10.0)
\===================
- feat: upgrade to mongodb driver 4.14.0 [#13036](https://redirect.github.com/Automattic/mongoose/issues/13036)
- feat: added Schema.prototype.omit() function [#12939](https://redirect.github.com/Automattic/mongoose/issues/12939) [#12931](https://redirect.github.com/Automattic/mongoose/issues/12931) [lpizzinidev](https://redirect.github.com/lpizzinidev)
- feat(index): added createInitialConnection option to Mongoose constructor [#13021](https://redirect.github.com/Automattic/mongoose/issues/13021) [#12965](https://redirect.github.com/Automattic/mongoose/issues/12965) [lpizzinidev](https://redirect.github.com/lpizzinidev)
### [`v6.9.3`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#693--2023-02-22)
[Compare Source](https://redirect.github.com/Automattic/mongoose/compare/6.9.2...6.9.3)
\==================
- fix(connection): delay calculating `autoCreate` and `autoIndex` until after initial connection established [#13007](https://redirect.github.com/Automattic/mongoose/issues/13007) [#12940](https://redirect.github.com/Automattic/mongoose/issues/12940) [lpizzinidev](https://redirect.github.com/lpizzinidev)
- fix(discriminator): allows update doc with discriminatorKey [#13056](https://redirect.github.com/Automattic/mongoose/issues/13056) [#13055](https://redirect.github.com/Automattic/mongoose/issues/13055) [abarriel](https://redirect.github.com/abarriel)
- fix(query): avoid sending unnecessary empty projection to MongoDB server [#13059](https://redirect.github.com/Automattic/mongoose/issues/13059) [#13050](https://redirect.github.com/Automattic/mongoose/issues/13050)
- fix(model): avoid sending null session option with document operations [#13053](https://redirect.github.com/Automattic/mongoose/issues/13053) [#13052](https://redirect.github.com/Automattic/mongoose/issues/13052) [lpizzinidev](https://redirect.github.com/lpizzinidev)
- fix(types): use MergeTypes for type overrides in HydratedDocument [#13066](https://redirect.github.com/Automattic/mongoose/issues/13066) [#13040](https://redirect.github.com/Automattic/mongoose/issues/13040)
- docs(middleware): list validate as a potential query middleware [#13057](https://redirect.github.com/Automattic/mongoose/issues/13057) [#12680](https://redirect.github.com/Automattic/mongoose/issues/12680)
- docs(getters-setters): explain that getters do not run by default on toJSON() [#13058](https://redirect.github.com/Automattic/mongoose/issues/13058) [#13049](https://redirect.github.com/Automattic/mongoose/issues/13049)
- docs: refactor docs generation scripts [#13044](https://redirect.github.com/Automattic/mongoose/issues/13044) [hasezoey](https://redirect.github.com/hasezoey)
### [`v6.9.2`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#692--2023-02-16)
[Compare Source](https://redirect.github.com/Automattic/mongoose/compare/6.9.1...6.9.2)
\==================
- fix(model): fixed post('save') callback parameter [#13030](https://redirect.github.com/Automattic/mongoose/issues/13030) [#13026](https://redirect.github.com/Automattic/mongoose/issues/13026) [lpizzinidev](https://redirect.github.com/lpizzinidev)
- fix(UUID): added null check to prevent error on binaryToString conversion [#13034](https://redirect.github.com/Automattic/mongoose/issues/13034) [#13032](https://redirect.github.com/Automattic/mongoose/issues/13032) [#13029](https://redirect.github.com/Automattic/mongoose/issues/13029) [lpizzinidev](https://redirect.github.com/lpizzinidev) [Freezystem](https://redirect.github.com/Freezystem)
- fix(query): revert breaking changes introduced by [#12797](https://redirect.github.com/Automattic/mongoose/issues/12797) [#12999](https://redirect.github.com/Automattic/mongoose/issues/12999) [lpizzinidev](https://redirect.github.com/lpizzinidev)
- fix(document): make array $shift() use $pop instead of overwriting array [#13004](https://redirect.github.com/Automattic/mongoose/issues/13004)
- docs: update & remove old links [#13019](https://redirect.github.com/Automattic/mongoose/issues/13019) [hasezoey](https://redirect.github.com/hasezoey)
- docs(middleware): describe how to access model from document middleware [#13031](https://redirect.github.com/Automattic/mongoose/issues/13031) [AxeOfMen](https://redirect.github.com/AxeOfMen)
- docs: update broken & outdated links [#13001](https://redirect.github.com/Automattic/mongoose/issues/13001) [hasezoey](https://redirect.github.com/hasezoey)
- chore: change deno tests to also use MMS [#12918](https://redirect.github.com/Automattic/mongoose/issues/12918) [hasezoey](https://redirect.github.com/hasezoey)
### [`v6.9.1`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#691--2023-02-06)
[Compare Source](https://redirect.github.com/Automattic/mongoose/compare/6.9.0...6.9.1)
\==================
- fix(document): isModified should not be triggered when setting a nested boolean to the same value as previously [#12994](https://redirect.github.com/Automattic/mongoose/issues/12994) [lpizzinidev](https://redirect.github.com/lpizzinidev)
- fix(document): save newly set defaults underneath single nested subdocuments [#13002](https://redirect.github.com/Automattic/mongoose/issues/13002) [#12905](https://redirect.github.com/Automattic/mongoose/issues/12905)
- fix(update): handle custom discriminator model name when casting update [#12947](https://redirect.github.com/Automattic/mongoose/issues/12947) [wassil](https://redirect.github.com/wassil)
- fix(connection): handles unique autoincrement ID for connections [#12990](https://redirect.github.com/Automattic/mongoose/issues/12990) [lpizzinidev](https://redirect.github.com/lpizzinidev)
- fix(types): fix type of options of Model.aggregate [#12933](https://redirect.github.com/Automattic/mongoose/issues/12933) [ghost91-](https://redirect.github.com/ghost91-)
- fix(types): fix "near" aggregation operator input type [#12954](https://redirect.github.com/Automattic/mongoose/issues/12954) [Jokero](https://redirect.github.com/Jokero)
- fix(types): add missing Top operator to AccumulatorOperator type declaration [#12952](https://redirect.github.com/Automattic/mongoose/issues/12952) [lpizzinidev](https://redirect.github.com/lpizzinidev)
- docs(transactions): added example for Connection.transaction() method [#12943](https://redirect.github.com/Automattic/mongoose/issues/12943) [#12934](https://redirect.github.com/Automattic/mongoose/issues/12934) [lpizzinidev](https://redirect.github.com/lpizzinidev)
- docs(populate): fix out of date comment referencing onModel property [#13000](https://redirect.github.com/Automattic/mongoose/issues/13000)
- docs(transactions): fix typo in transactions.md [#12995](https://redirect.github.com/Automattic/mongoose/issues/12995) [Parth86](https://redirect.github.com/Parth86)
### [`v6.9.0`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#690--2023-01-25)
[Compare Source](https://redirect.github.com/Automattic/mongoose/compare/6.8.4...6.9.0)
\==================
- feat(schema): add removeVirtual(path) function to schema [#12920](https://redirect.github.com/Automattic/mongoose/issues/12920) [IslandRhythms](https://redirect.github.com/IslandRhythms)
- fix(cast): remove empty `$or` conditions after strict applied [#12898](https://redirect.github.com/Automattic/mongoose/issues/12898) [0x0a0d](https://redirect.github.com/0x0a0d)
- docs: fixed typo [#12946](https://redirect.github.com/Automattic/mongoose/issues/12946) [Gbengstar](https://redirect.github.com/Gbengstar)
### [`v6.8.4`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#684--2023-01-17)
[Compare Source](https://redirect.github.com/Automattic/mongoose/compare/6.8.3...6.8.4)
\==================
- fix(collection): handle creating model when connection disconnected with bufferCommands = false [#12889](https://redirect.github.com/Automattic/mongoose/issues/12889)
- fix(populate): merge instead of overwrite when match is on \_id [#12891](https://redirect.github.com/Automattic/mongoose/issues/12891)
- fix: add guard to stop loadClass copying Document if Document is used as base of loaded class (same hack as implemented for Model already) [#12820](https://redirect.github.com/Automattic/mongoose/issues/12820) [sgpinkus](https://redirect.github.com/sgpinkus)
- fix(types): correctly infer types on document arrays [#12884](https://redirect.github.com/Automattic/mongoose/issues/12884) [#12882](https://redirect.github.com/Automattic/mongoose/issues/12882) [JavaScriptBach](https://redirect.github.com/JavaScriptBach)
- fix(types): added omit for ArraySubdocument type in LeanType declaration [#12903](https://redirect.github.com/Automattic/mongoose/issues/12903) [piyushk96](https://redirect.github.com/piyushk96)
- fix(types): add returnDocument type safety [#12906](https://redirect.github.com/Automattic/mongoose/issues/12906) [AbdelrahmanHafez](https://redirect.github.com/AbdelrahmanHafez)
- docs(typescript): add notes about virtual context to Mongoose 6 migration and TypeScript virtuals docs [#12912](https://redirect.github.com/Automattic/mongoose/issues/12912) [#12806](https://redirect.github.com/Automattic/mongoose/issues/12806)
- docs(schematypes): removed dead link and fixed formatting [#12897](https://redirect.github.com/Automattic/mongoose/issues/12897) [#12885](https://redirect.github.com/Automattic/mongoose/issues/12885) [lpizzinidev](https://redirect.github.com/lpizzinidev)
- docs: fix link to lean api [#12910](https://redirect.github.com/Automattic/mongoose/issues/12910) [manniL](https://redirect.github.com/manniL)
- docs: list all possible strings for schema.pre in one place [#12868](https://redirect.github.com/Automattic/mongoose/issues/12868)
- docs: add list of known incompatible npm packages [#12892](https://redirect.github.com/Automattic/mongoose/issues/12892) [IslandRhythms](https://redirect.github.com/IslandRhythms)
### [`v6.8.3`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#683--2023-01-06)
[Compare Source](https://redirect.github.com/Automattic/mongoose/compare/6.8.2...6.8.3)
\==================
- perf: improve performance of assignRawDocsToIdStructure for faster populate on large docs [#12867](https://redirect.github.com/Automattic/mongoose/issues/12867) [Uzlopak](https://redirect.github.com/Uzlopak)
- fix(model): ensure consistent ordering of validation errors in insertMany() with ordered: false and rawResult: true [#12866](https://redirect.github.com/Automattic/mongoose/issues/12866)
- fix: avoid passing final callback to pre hook, because calling the callback can mess up hook execution [#12836](https://redirect.github.com/Automattic/mongoose/issues/12836)
- fix(types): avoid inferring timestamps if methods, virtuals, or statics set [#12871](https://redirect.github.com/Automattic/mongoose/issues/12871)
- fix(types): correctly infer string enums on const arrays [#12870](https://redirect.github.com/Automattic/mongoose/issues/12870) [JavaScriptBach](https://redirect.github.com/JavaScriptBach)
- fix(types): allow virtuals to be invoked in the definition of other virtuals [#12874](https://redirect.github.com/Automattic/mongoose/issues/12874) [sffc](https://redirect.github.com/sffc)
- fix(types): add type def for Aggregate#model without arguments [#12864](https://redirect.github.com/Automattic/mongoose/issues/12864) [hasezoey](https://redirect.github.com/hasezoey)
- docs(discriminators): add section about changing discriminator key [#12861](https://redirect.github.com/Automattic/mongoose/issues/12861)
- docs(typescript): explain that virtuals inferred from schema only show up on Model, not raw document type [#12860](https://redirect.github.com/Automattic/mongoose/issues/12860) [#12684](https://redirect.github.com/Automattic/mongoose/issues/12684)
### [`v6.8.2`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#682--2022-12-28)
[Compare Source](https://redirect.github.com/Automattic/mongoose/compare/6.8.1...6.8.2)
\==================
- fix(schema): propagate strictQuery to implicitly created schemas for embedded discriminators [#12827](https://redirect.github.com/Automattic/mongoose/issues/12827) [#12796](https://redirect.github.com/Automattic/mongoose/issues/12796)
- fix(model): respect discriminators with Model.validate() [#12824](https://redirect.github.com/Automattic/mongoose/issues/12824) [#12621](https://redirect.github.com/Automattic/mongoose/issues/12621)
- fix(query): fix unexpected validation error when doing findOneAndReplace() with a nullish value [#12826](https://redirect.github.com/Automattic/mongoose/issues/12826) [#12821](https://redirect.github.com/Automattic/mongoose/issues/12821)
- fix(discriminator): apply built-in plugins to discriminator schema even if mergeHooks and mergePlugins are both false [#12833](https://redirect.github.com/Automattic/mongoose/issues/12833) [#12696](https://redirect.github.com/Automattic/mongoose/issues/12696)
- fix(types): add option "overwriteModels" as a schema option [#12817](https://redirect.github.com/Automattic/mongoose/issues/12817) [#12816](https://redirect.github.com/Automattic/mongoose/issues/12816) [hasezoey](https://redirect.github.com/hasezoey)
- fix(types): add property "defaultOptions" [#12818](https://redirect.github.com/Automattic/mongoose/issues/12818) [hasezoey](https://redirect.github.com/hasezoey)
- docs: make search bar respect documentation version, so you can search 5.x docs [#12548](https://redirect.github.com/Automattic/mongoose/issues/12548)
- docs(typescript): make note about recommending strict mode when using auto typed schemas [#12825](https://redirect.github.com/Automattic/mongoose/issues/12825) [#12420](https://redirect.github.com/Automattic/mongoose/issues/12420)
- docs: add section on sorting to query docs [#12588](https://redirect.github.com/Automattic/mongoose/issues/12588) [IslandRhythms](https://redirect.github.com/IslandRhythms)
- test(query.test): add write-concern option [#12829](https://redirect.github.com/Automattic/mongoose/issues/12829) [hasezoey](https://redirect.github.com/hasezoey)
### [`v6.8.1`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#681--2022-12-19)
[Compare Source](https://redirect.github.com/Automattic/mongoose/compare/6.8.0...6.8.1)
\==================
- fix(query): avoid throwing circular dependency error if same object is used in multiple properties [#12774](https://redirect.github.com/Automattic/mongoose/issues/12774) [orgads](https://redirect.github.com/orgads)
- fix(map): return value from super.delete() [#12777](https://redirect.github.com/Automattic/mongoose/issues/12777) [danbrud](https://redirect.github.com/danbrud)
- fix(populate): handle virtual populate underneath document array with justOne=true and sort set where 1 element has only 1 result [#12815](https://redirect.github.com/Automattic/mongoose/issues/12815) [#12730](https://redirect.github.com/Automattic/mongoose/issues/12730)
- fix(update): handle embedded discriminators when casting array filters [#12802](https://redirect.github.com/Automattic/mongoose/issues/12802) [#12565](https://redirect.github.com/Automattic/mongoose/issues/12565)
- fix(populate): avoid calling transform if there's no populate results and using lean [#12804](https://redirect.github.com/Automattic/mongoose/issues/12804) [#12739](https://redirect.github.com/Automattic/mongoose/issues/12739)
- fix(model): prevent index creation on syncIndexes if not necessary [#12785](https://redirect.github.com/Automattic/mongoose/issues/12785) [#12250](https://redirect.github.com/Automattic/mongoose/issues/12250) [lpizzinidev](https://redirect.github.com/lpizzinidev)
- fix(types): correctly infer this when using pre('updateOne') with { document: true, query: false } [#12778](https://redirect.github.com/Automattic/mongoose/issues/12778)
- fix(types): make InferSchemaType: consider { required: boolean } required if it isn't explicitly false [#12784](https://redirect.github.com/Automattic/mongoose/issues/12784) [JavaScriptBach](https://redirect.github.com/JavaScriptBach)
- docs: replace many occurrences of "localhost" with "127.0.0.1" [#12811](https://redirect.github.com/Automattic/mongoose/issues/12811) [#12741](https://redirect.github.com/Automattic/mongoose/issues/12741) [hasezoey](https://redirect.github.com/hasezoey) [SadiqOnGithub](https://redirect.github.com/SadiqOnGithub)
- docs(mongoose): Added missing options to set [#12810](https://redirect.github.com/Automattic/mongoose/issues/12810) [lpizzinidev](https://redirect.github.com/lpizzinidev)
- docs: add info on `$locals` parameters to getters/setters tutorial [#12814](https://redirect.github.com/Automattic/mongoose/issues/12814) [#12550](https://redirect.github.com/Automattic/mongoose/issues/12550) [IslandRhythms](https://redirect.github.com/IslandRhythms)
- docs: make Document.prototype.$clone() public [#12803](https://redirect.github.com/Automattic/mongoose/issues/12803)
- docs(query): updated explanation for slice [#12776](https://redirect.github.com/Automattic/mongoose/issues/12776) [#12474](https://redirect.github.com/Automattic/mongoose/issues/12474) [lpizzinidev](https://redirect.github.com/lpizzinidev)
- docs(middleware): fix broken links [#12787](https://redirect.github.com/Automattic/mongoose/issues/12787) [lpizzinidev](https://redirect.github.com/lpizzinidev)
- docs(queries): fixed broken links [#12790](https://redirect.github.com/Automattic/mongoose/issues/12790) [lpizzinidev](https://redirect.github.com/lpizzinidev)
### [`v6.8.0`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#680--2022-12-05)
[Compare Source](https://redirect.github.com/Automattic/mongoose/compare/6.7.5...6.8.0)
\==================
- feat: add alpha support for Deno [#12397](https://redirect.github.com/Automattic/mongoose/issues/12397) [#9056](https://redirect.github.com/Automattic/mongoose/issues/9056)
- feat: add deprecation warning for default strictQuery [#12666](https://redirect.github.com/Automattic/mongoose/issues/12666)
- feat: upgrade to MongoDB driver 4.12.1
- feat(schema): add doc as second params to validation message function [#12564](https://redirect.github.com/Automattic/mongoose/issues/12564) [#12651](https://redirect.github.com/Automattic/mongoose/issues/12651) [IslandRhythms](https://redirect.github.com/IslandRhythms)
- feat(document): add $clone method [#12549](https://redirect.github.com/Automattic/mongoose/issues/12549) [#11849](https://redirect.github.com/Automattic/mongoose/issues/11849) [lpizzinidev](https://redirect.github.com/lpizzinidev)
- feat(populate): allow overriding `localField` and `foreignField` for virtual populate [#12657](https://redirect.github.com/Automattic/mongoose/issues/12657) [#6963](https://redirect.github.com/Automattic/mongoose/issues/6963) [IslandRhythms](https://redirect.github.com/IslandRhythms)
- feat(schema+types): add { errorHandler: true } option to Schema post() for better TypeScript support [#12723](https://redirect.github.com/Automattic/mongoose/issues/12723) [#12583](https://redirect.github.com/Automattic/mongoose/issues/12583)
- feat(debug): allow setting debug on a per-connection basis [#12704](https://redirect.github.com/Automattic/mongoose/issues/12704) [#12700](https://redirect.github.com/Automattic/mongoose/issues/12700) [lpizzinidev](https://redirect.github.com/lpizzinidev)
- feat: add rewind function to QueryCursor [#12710](https://redirect.github.com/Automattic/mongoose/issues/12710) [passabilities](https://redirect.github.com/passabilities)
- feat(types): infer timestamps option from schema [#12731](https://redirect.github.com/Automattic/mongoose/issues/12731) [#12069](https://redirect.github.com/Automattic/mongoose/issues/12069)
- docs: change links to not link to api.html anymore [#12644](https://redirect.github.com/Automattic/mongoose/issues/12644) [hasezoey](https://redirect.github.com/hasezoey)
### [`v6.7.5`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#675--2022-11-30)
[Compare Source](https://redirect.github.com/Automattic/mongoose/compare/6.7.4...6.7.5)
\==================
- fix(schema): copy indexes when calling add() with schema instance [#12737](https://redirect.github.com/Automattic/mongoose/issues/12737) [#12654](https://redirect.github.com/Automattic/mongoose/issues/12654)
- fix(query): handle deselecting \_id when another field has schema-level select: false [#12736](https://redirect.github.com/Automattic/mongoose/issues/12736) [#12670](https://redirect.github.com/Automattic/mongoose/issues/12670)
- fix(types): support using UpdateQuery in bulkWrite() [#12742](https://redirect.github.com/Automattic/mongoose/issues/12742) [#12595](https://redirect.github.com/Automattic/mongoose/issues/12595)
- docs(middleware): added note about execution policy on subdocuments [#12735](https://redirect.github.com/Automattic/mongoose/issues/12735) [#12694](https://redirect.github.com/Automattic/mongoose/issues/12694) [lpizzinidev](https://redirect.github.com/lpizzinidev)
- docs(validation): clarify context for update validators in validation docs [#12738](https://redirect.github.com/Automattic/mongoose/issues/12738) [#12655](https://redirect.github.com/Automattic/mongoose/issues/12655) [IslandRhythms](https://redirect.github.com/IslandRhythms)
### [`v6.7.4`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#674--2022-11-28)
[Compare Source](https://redirect.github.com/Automattic/mongoose/compare/6.7.3...6.7.4)
\==================
- fix: allow setting global strictQuery after Schema creation [#12717](https://redirect.github.com/Automattic/mongoose/issues/12717) [#12703](https://redirect.github.com/Automattic/mongoose/issues/12703) [lpizzinidev](https://redirect.github.com/lpizzinidev)
- fix(cursor): make eachAsync() avoid modifying batch when mixing parallel and batchSize [#12716](https://redirect.github.com/Automattic/mongoose/issues/12716)
- fix(types): infer virtuals in query results [#12727](https://redirect.github.com/Automattic/mongoose/issues/12727) [#12702](https://redirect.github.com/Automattic/mongoose/issues/12702) [#12684](https://redirect.github.com/Automattic/mongoose/issues/12684)
- fix(types): correctly infer ReadonlyArray types in schema definitions [#12720](https://redirect.github.com/Automattic/mongoose/issues/12720)
- fix(types): avoid typeof Query with generics for TypeScript 4.6 support [#12712](https://redirect.github.com/Automattic/mongoose/issues/12712) [#12688](https://redirect.github.com/Automattic/mongoose/issues/12688)
- chore: avoid bundling .tgz files when publishing [#12725](https://redirect.github.com/Automattic/mongoose/issues/12725) [hasezoey](https://redirect.github.com/hasezoey)
### [`v6.7.3`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#673--2022-11-22)
[Compare Source](https://redirect.github.com/Automattic/mongoose/compare/6.7.2...6.7.3)
\==================
- fix(document): handle setting array to itself after saving and pushing a new value [#12672](https://redirect.github.com/Automattic/mongoose/issues/12672) [#12656](https://redirect.github.com/Automattic/mongoose/issues/12656)
- fix(types): update replaceWith pipeline stage [#12715](https://redirect.github.com/Automattic/mongoose/issues/12715) [coyotte508](https://redirect.github.com/coyotte508)
- fix(types): remove incorrect modelName type definition [#12682](https://redirect.github.com/Automattic/mongoose/issues/12682) [#12669](https://redirect.github.com/Automattic/mongoose/issues/12669) [lpizzinidev](https://redirect.github.com/lpizzinidev)
- fix(schema): fix setupTimestamps for browser.umd [#12683](https://redirect.github.com/Automattic/mongoose/issues/12683) [raphael-papazikas](https://redirect.github.com/raphael-papazikas)
- docs: correct justOne description [#12686](https://redirect.github.com/Automattic/mongoose/issues/12686) [#12599](https://redirect.github.com/Automattic/mongoose/issues/12599) [tianguangcn](https://redirect.github.com/tianguangcn)
- docs: make links more consistent [#12690](https://redirect.github.com/Automattic/mongoose/issues/12690) [#12645](https://redirect.github.com/Automattic/mongoose/issues/12645) [hasezoey](https://redirect.github.com/hasezoey)
- docs(document): explain that $isNew is false in post('save') hooks [#12685](https://redirect.github.com/Automattic/mongoose/issues/12685) [#11990](https://redirect.github.com/Automattic/mongoose/issues/11990)
- docs: fixed line causing a "used before defined" linting error [#12707](https://redirect.github.com/Automattic/mongoose/issues/12707) [sgpinkus](https://redirect.github.com/sgpinkus)
### [`v6.7.2`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#672--2022-11-07)
[Compare Source](https://redirect.github.com/Automattic/mongoose/compare/6.7.1...6.7.2)
\==================
- fix(discriminator): skip copying base schema plugins if `applyPlugins == false` [#12613](https://redirect.github.com/Automattic/mongoose/issues/12613) [#12604](https://redirect.github.com/Automattic/mongoose/issues/12604) [lpizzinidev](https://redirect.github.com/lpizzinidev)
- fix(types): add UUID to types [#12650](https://redirect.github.com/Automattic/mongoose/issues/12650) [#12593](https://redirect.github.com/Automattic/mongoose/issues/12593)
- fix(types): allow setting SchemaTypeOptions' index property to IndexOptions [#12562](https://redirect.github.com/Automattic/mongoose/issues/12562)
- fix(types): set this to doc type in SchemaType.prototype.validate() [#12663](https://redirect.github.com/Automattic/mongoose/issues/12663) [#12590](https://redirect.github.com/Automattic/mongoose/issues/12590)
- fix(types): correct handling for model [#12659](https://redirect.github.com/Automattic/mongoose/issues/12659) [#12573](https://redirect.github.com/Automattic/mongoose/issues/12573)
- fix(types): pre hook with deleteOne should resolve this as Query [#12642](https://redirect.github.com/Automattic/mongoose/issues/12642) [#12622](https://redirect.github.com/Automattic/mongoose/issues/12622) [lpizzinidev](https://redirect.github.com/lpizzinidev)
### [`v6.7.1`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#671--2022-11-02)
[Compare Source](https://redirect.github.com/Automattic/mongoose/compare/6.7.0...6.7.1)
\==================
- fix(query): select Map field with select: false when explicitly requested [#12616](https://redirect.github.com/Automattic/mongoose/issues/12616) [#12603](https://redirect.github.com/Automattic/mongoose/issues/12603) [lpizzinidev](https://redirect.github.com/lpizzinidev)
- fix: correctly find paths underneath single nested document with an array of mixed [#12605](https://redirect.github.com/Automattic/mongoose/issues/12605) [#12530](https://redirect.github.com/Automattic/mongoose/issues/12530)
- fix(populate): better support for populating maps of arrays of refs [#12601](https://redirect.github.com/Automattic/mongoose/issues/12601) [#12494](https://redirect.github.com/Automattic/mongoose/issues/12494)
- fix(types): add missing create constructor signature override type [#12585](https://redirect.github.com/Automattic/mongoose/issues/12585) [naorpeled](https://redirect.github.com/naorpeled)
- fix(types): make array paths optional in inferred type of array default returns undefined [#12649](https://redirect.github.com/Automattic/mongoose/issues/12649) [#12420](https://redirect.github.com/Automattic/mongoose/issues/12420)
- fix(types): improve ValidateOpts type [#12606](https://redirect.github.com/Automattic/mongoose/issues/12606) [Freezystem](https://redirect.github.com/Freezystem)
- docs: add Lodash guide highlighting issues with cloneDeep() [#12609](https://redirect.github.com/Automattic/mongoose/issues/12609)
- docs: removed v5 link from v6 docs [#12641](https://redirect.github.com/Automattic/mongoose/issues/12641) [#12624](https://redirect.github.com/Automattic/mongoose/issues/12624) [lpizzinidev](https://redirect.github.com/lpizzinidev)
- docs: removed outdated connection example [#12618](https://redirect.github.com/Automattic/mongoose/issues/12618) [lpizzinidev](https://redirect.github.com/lpizzinidev)
### [`v6.7.0`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#670--2022-10-24)
[Compare Source](https://redirect.github.com/Automattic/mongoose/compare/6.6.7...6.7.0)
\==================
- feat: upgrade to mongodb driver 4.11.0 [#12446](https://redirect.github.com/Automattic/mongoose/issues/12446)
- feat: add UUID Schema Type (BSON Buffer SubType 4) [#12268](https://redirect.github.com/Automattic/mongoose/issues/12268) [#3208](https://redirect.github.com/Automattic/mongoose/issues/3208) [hasezoey](https://redirect.github.com/hasezoey)
- feat(aggregation): add $fill pipeline stage [#12545](https://redirect.github.com/Automattic/mongoose/issues/12545) [raphael-papazikas](https://redirect.github.com/raphael-papazikas)
- feat(types+schema): allow defining schema paths using mongoose.Types.\* to work around TS type inference issues [#12352](https://redirect.github.com/Automattic/mongoose/issues/12352)
- feat(schema): add alias() method that makes it easier to define multiple aliases for a given path [#12368](https://redirect.github.com/Automattic/mongoose/issues/12368)
- feat(model): add mergeHooks option to Model.discriminator() to avoid duplicate hooks [#12542](https://redirect.github.com/Automattic/mongoose/issues/12542)
- feat(document): add $timestamps() method to set timestamps for save(), bulkSave(), and insertMany() [#12540](https://redirect.github.com/Automattic/mongoose/issues/12540)
### [`v6.6.7`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#667--2022-10-21)
[Compare Source](https://redirect.github.com/Automattic/mongoose/compare/6.6.6...6.6.7)
\==================
- fix: correct browser build and improve isAsyncFunction check for browser [#12577](https://redirect.github.com/Automattic/mongoose/issues/12577) [#12576](https://redirect.github.com/Automattic/mongoose/issues/12576) [#12392](https://redirect.github.com/Automattic/mongoose/issues/12392)
- fix(query): allow overwriting discriminator key with overwriteDiscriminatorKey if strict: 'throw' [#12578](https://redirect.github.com/Automattic/mongoose/issues/12578) [#12513](https://redirect.github.com/Automattic/mongoose/issues/12513)
### [`v6.6.6`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#666--2022-10-20)
[Compare Source](https://redirect.github.com/Automattic/mongoose/compare/6.6.5...6.6.6)
\==================
- fix(update): handle runValidators when using $set on a doc array in discriminator schema [#12571](https://redirect.github.com/Automattic/mongoose/issues/12571) [#12518](https://redirect.github.com/Automattic/mongoose/issues/12518)
- fix(document): allow creating document with document array and top-level key named schema [#12569](https://redirect.github.com/Automattic/mongoose/issues/12569) [#12480](https://redirect.github.com/Automattic/mongoose/issues/12480)
- fix(cast): make schema-level strictQuery override schema-level strict for query filters [#12570](https://redirect.github.com/Automattic/mongoose/issues/12570) [#12508](https://redirect.github.com/Automattic/mongoose/issues/12508)
- fix(aggregate): avoid adding extra $match stage if user manually set discriminator key to correct value in first pipeline stage [#12568](https://redirect.github.com/Automattic/mongoose/issues/12568) [#12478](https://redirect.github.com/Automattic/mongoose/issues/12478)
- fix: Throws error when updating a key name that match the discriminator key name on nested object [#12534](https://redirect.github.com/Automattic/mongoose/issues/12534) [#12517](https://redirect.github.com/Automattic/mongoose/issues/12517) [lpizzinidev](https://redirect.github.com/lpizzinidev)
- fix(types): add limit to $filter expression [#12553](https://redirect.github.com/Automattic/mongoose/issues/12553) [raphael-papazikas](https://redirect.github.com/raphael-papazikas)
- fix(types): correct replaceWith type pipeline stage [#12535](https://redirect.github.com/Automattic/mongoose/issues/12535) [FabioCingottini](https://redirect.github.com/FabioCingottini)
- fix(types): add missing densify type pipeline type [#12533](https://redirect.github.com/Automattic/mongoose/issues/12533) [FabioCingottini](https://redirect.github.com/FabioCingottini)
- docs(populate): added transform option description [#12560](https://redirect.github.com/Automattic/mongoose/issues/12560) [#12551](https://redirect.github.com/Automattic/mongoose/issues/12551) [lpizzinidev](https://redirect.github.com/lpizzinidev)
- docs(connection): add sample to useDb() documentation [#12541](https://redirect.github.com/Automattic/mongoose/issues/12541) [lpizzinidev](https://redirect.github.com/lpizzinidev)
- docs(guide): update broken read-preference links [#12538](https://redirect.github.com/Automattic/mongoose/issues/12538) [#12525](https://redirect.github.com/Automattic/mongoose/issues/12525) [hasezoey](https://redirect.github.com/hasezoey)
- chore: add TypeScript version field to issue template [#12532](https://redirect.github.com/Automattic/mongoose/issues/12532) [hasezoey](https://redirect.github.com/hasezoey)
### [`v6.6.5`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#665--2022-10-05)
[Compare Source](https://redirect.github.com/Automattic/mongoose/compare/6.6.4...6.6.5)
\==================
- fix(document): set defaults on subdocuments underneath init-ed single nested subdocument [#12523](https://redirect.github.com/Automattic/mongoose/issues/12523) [#12515](https://redirect.github.com/Automattic/mongoose/issues/12515)
- fix: make Jest fake timers check more robust to other libs that overwrite time functions [#12527](https://redirect.github.com/Automattic/mongoose/issues/12527) [#12514](https://redirect.github.com/Automattic/mongoose/issues/12514)
- fix(types): indicate that Schema.prototype.discriminator() returns this [#12522](https://redirect.github.com/Automattic/mongoose/issues/12522) [#12457](https://redirect.github.com/Automattic/mongoose/issues/12457)
- fix(types): add "estimatedDocumentCount" and "countDocuments" as possible hooks [#12519](https://redirect.github.com/Automattic/mongoose/issues/12519) [#12516](https://redirect.github.com/Automattic/mongoose/issues/12516)
- docs(models): add section on MongoDB Views [#12526](https://redirect.github.com/Automattic/mongoose/issues/12526) [#5694](https://redirect.github.com/Automattic/mongoose/issues/5694)
- docs(subdocs): clarify that populated docs are not subdocs [#12521](https://redirect.github.com/Automattic/mongoose/issues/12521) [#12398](https://redirect.github.com/Automattic/mongoose/issues/12398)
- docs(change-streams): remove unnecessary obsolete comment about needing to use mongodb driver change streams [#12444](https://redirect.github.com/Automattic/mongoose/issues/12444)
### [`v6.6.4`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#664--2022-10-03)
[Compare Source](https://redirect.github.com/Automattic/mongoose/compare/6.6.3...6.6.4)
\==================
- fix(model): avoid saving applied defaults if path is deselected [#12506](https://redirect.github.com/Automattic/mongoose/issues/12506) [#12414](https://redirect.github.com/Automattic/mongoose/issues/12414)
- fix(types): correct DocType for auto typed query helpers [#12342](https://redirect.github.com/Automattic/mongoose/issues/12342)
- fix(types): avoid "excessively deep" type instantiation error when using bulkWrite() with type that extends from document [#12277](https://redirect.github.com/Automattic/mongoose/issues/12277)
- fix(types): avoid relying on typeof this, which isn't supported in TypeScript < 4.4 [#12375](https://redirect.github.com/Automattic/mongoose/issues/12375)
- docs(schema): correct example for Schema.prototype.discriminator() [#12493](https://redirect.github.com/Automattic/mongoose/issues/12493)
- docs(typescript): clean up query helpers examples [#12342](https://redirect.github.com/Automattic/mongoose/issues/12342)
- chore: use mongodb-memory-server for testing [#12262](https://redirect.github.com/Automattic/mongoose/issues/12262) [hasezoey](https://redirect.github.com/hasezoey)
### [`v6.6.3`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#663--2022-09-30)
[Compare Source](https://redirect.github.com/Automattic/mongoose/compare/6.6.2...6.6.3)
\==================
- fix(query): treat findOne(\_id) as equivalent to findOne({ \_id }) [#12485](https://redirect.github.com/Automattic/mongoose/issues/12485) [#12325](https://redirect.github.com/Automattic/mongoose/issues/12325)
- fix(timestamps): findOneAndUpdate creates subdocs with timestamps in reverse order [#12484](https://redirect.github.com/Automattic/mongoose/issues/12484) [#12475](https://redirect.github.com/Automattic/mongoose/issues/12475) [lpizzinidev](https://redirect.github.com/lpizzinidev)
- fix(types): make schema.plugin() more flexible for schemas that don't define any generics [#12486](https://redirect.github.com/Automattic/mongoose/issues/12486) [#12454](https://redirect.github.com/Automattic/mongoose/issues/12454)
- fix(types): add "array of array key-value pairs" as a argument option for "query.sort()" [#12483](https://redirect.github.com/Automattic/mongoose/issues/12483) [#12434](https://redirect.github.com/Automattic/mongoose/issues/12434) [hasezoey](https://redirect.github.com/hasezoey)
- fix(types): remove unused defaults in "PluginFunction" [#12459](https://redirect.github.com/Automattic/mongoose/issues/12459) [hasezoey](https://redirect.github.com/hasezoey)
- fix(types): update DiscriminatorSchema to have better names and combine statics [#12460](https://redirect.github.com/Automattic/mongoose/issues/12460) [hasezoey](https://redirect.github.com/hasezoey)
### [`v6.6.2`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#662--2022-09-26)
[Compare Source](https://redirect.github.com/Automattic/mongoose/compare/6.6.1...6.6.2)
\==================
- fix(model): avoid deleting shared schema methods in fix for [#12254](https://redirect.github.com/Automattic/mongoose/issues/12254) [#12423](https://redirect.github.com/Automattic/mongoose/issues/12423)
- fix(document): set $inc default value in case field has not been specified on the document [#12435](https://redirect.github.com/Automattic/mongoose/issues/12435) [lpizzinidev](https://redirect.github.com/lpizzinidev)
- fix(query): handle `select: false` on map paths in query results [#12467](https://redirect.github.com/Automattic/mongoose/issues/12467) [lpizzinidev](https://redirect.github.com/lpizzinidev)
- fix(types): add HydratedDocumentFromSchema to make it easier to pull inferred hydrated doc type [#12464](https://redirect.github.com/Automattic/mongoose/issues/12464) [#12319](https://redirect.github.com/Automattic/mongoose/issues/12319)
- fix(types): add sanitizeFilter to types [#12465](https://redirect.github.com/Automattic/mongoose/issues/12465) [zrosenbauer](https://redirect.github.com/zrosenbauer)
- fix(types): infer number enum types from schema if using enum: \[0, 1] as const [#12463](https://redirect.github.com/Automattic/mongoose/issues/12463) [#12242](https://redirect.github.com/Automattic/mongoose/issues/12242)
- docs(validation): add section on global schematype validation, clean up other issues [#12430](https://redirect.github.com/Automattic/mongoose/issues/12430)
- docs: add clarification about overwrite flag in model.js [#12447](https://redirect.github.com/Automattic/mongoose/issues/12447) [Tzvika-m](https://redirect.github.com/Tzvika-m)
- docs: change to consistent "Example:" for jsdoc comments [#12432](https://redirect.github.com/Automattic/mongoose/issues/12432) [hasezoey](https://redirect.github.com/hasezoey)
### [`v6.6.1`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#661--2022-09-14)
[Compare Source](https://redirect.github.com/Automattic/mongoose/compare/6.6.0...6.6.1)
\==================
- fix: correctly apply defaults after subdoc init [#12328](https://redirect.github.com/Automattic/mongoose/issues/12328)
- fix(array): avoid using default \_id when using pull() [#12294](https://redirect.github.com/Automattic/mongoose/issues/12294)
- fix: allow null values inside $expr objects [#12429](https://redirect.github.com/Automattic/mongoose/issues/12429) [MartinDrost](https://redirect.github.com/MartinDrost)
- fix(query): use correct Query constructor when cloning query [#12418](https://redirect.github.com/Automattic/mongoose/issues/12418)
- docs(website): remove setting "latest38x" which is not used anywhere [#12396](https://redirect.github.com/Automattic/mongoose/issues/12396) [hasezoey](https://redirect.github.com/hasezoey)
### [`v6.6.0`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#660--2022-09-08)
[Compare Source](https://redirect.github.com/Automattic/mongoose/compare/6.5.5...6.6.0)
\==================
- feat: upgrade mongodb driver -> 4.9.1 [#12370](https://redirect.github.com/Automattic/mongoose/issues/12370) [AbdelrahmanHafez](https://redirect.github.com/AbdelrahmanHafez)
- feat: re-export default Mongoose instance properties for ESM named imports support [#12256](https://redirect.github.com/Automattic/mongoose/issues/12256)
- feat(model): add option to skip invalid fields with castObject() [#12156](https://redirect.github.com/Automattic/mongoose/issues/12156) [IslandRhythms](https://redirect.github.com/IslandRhythms)
- feat: use setPrototypeOf() instead of **proto** to allow running on Deno [#12315](https://redirect.github.com/Automattic/mongoose/issues/12315)
- feat(QueryCursor): add support for AbortSignal on eachAsync() [#12323](https://redirect.github.com/Automattic/mongoose/issues/12323)
- feat(types): add types for new $densify operator [#12118](https://redirect.github.com/Automattic/mongoose/issues/12118) [IslandRhythms](https://redirect.github.com/IslandRhythms)
### [`v6.5.5`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#655--2022-09-07)
[Compare Source](https://redirect.github.com/Automattic/mongoose/compare/6.5.4...6.5.5)
\==================
- fix(setDefaultsOnInsert): avoid applying defaults on insert if nested property set [#12279](https://redirect.github.com/Automattic/mongoose/issues/12279)
- fix(model): make applyHooks() and applyMethods() handle case where custom method is set to Mongoose implementation [#12254](https://redirect.github.com/Automattic/mongoose/issues/12254)
- fix(types): add string "ascending" and "descending" index-directions [#10269](https://redirect.github.com/Automattic/mongoose/issues/10269)
- docs: upgrade dox to 1.0.0 [#12403](https://redirect.github.com/Automattic/mongoose/issues/12403) [hasezoey](https://redirect.github.com/hasezoey)
- docs: update old mongodb nodejs driver documentation urls [#12387](https://redirect.github.com/Automattic/mongoose/issues/12387) [hasezoey](https://redirect.github.com/hasezoey)
- docs: update JSDOC ... (spread) definition [#12388](https://redirect.github.com/Automattic/mongoose/issues/12388) [hasezoey](https://redirect.github.com/hasezoey)
- refactor(model): allow optionally passing indexes to createIndexes and cleanIndexes [#12280](https://redirect.github.com/Automattic/mongoose/issues/12280) [AbdelrahmanHafez](https://redirect.github.com/AbdelrahmanHafez)
### [`v6.5.4`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#654--2022-08-30)
[Compare Source](https://redirect.github.com/Automattic/mongoose/compare/6.5.3...6.5.4)
\==================
- fix(document): allow calling $assertPopulated() with values to better support manual population [#12233](https://redirect.github.com/Automattic/mongoose/issues/12233)
- fix(connection+mongoose): better handling for calling model() with 1 argument [#12359](https://redirect.github.com/Automattic/mongoose/issues/12359)
- fix(model): allow defining discriminator virtuals and methods using schema options [#12326](https://redirect.github.com/Automattic/mongoose/issues/12326)
- fix(types): fix MongooseQueryMiddleware missing "findOneAndReplace" and "replaceOne" [#12330](https://redirect.github.com/Automattic/mongoose/issues/12330) [#12329](https://redirect.github.com/Automattic/mongoose/issues/12329) [Jule-](https://redirect.github.com/Jule-) [lpizzinidev](https://redirect.github.com/lpizzinidev)
- fix(types): fix replaceOne return type [#12351](https://redirect.github.com/Automattic/mongoose/issues/12351) [lpizzinidev](https://redirect.github.com/lpizzinidev)
- fix(types): use this for return type from $assertPopulated() [#12234](https://redirect.github.com/Automattic/mongoose/issues/12234)
- docs: highlight how to connect using auth in README [#12354](https://redirect.github.com/Automattic/mongoose/issues/12354) [AntonyOnScript](https://redirect.github.com/AntonyOnScript)
- docs: improve jsdoc comments for private methods [#12337](https://redirect.github.com/Automattic/mongoose/issues/12337) [hasezoey](https://redirect.github.com/hasezoey)
- docs: fix minor typo in compatibility table header [#12355](https://redirect.github.com/Automattic/mongoose/issues/12355) [skyme5](https://redirect.github.com/skyme5)
### [`v6.5.3`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#653--2022-08-24)
[Compare Source](https://redirect.github.com/Automattic/mongoose/compare/6.5.2...6.5.3)
\==================
- fix(document): handle maps when applying defaults to nested paths [#12322](https://redirect.github.com/Automattic/mongoose/issues/12322)
- fix(schema): make ArraySubdocuments apply \_id defaults on init [#12264](https://redirect.github.com/Automattic/mongoose/issues/12264)
- fix(populate): handle specifying recursive populate as a string with discriminators [#12266](https://redirect.github.com/Automattic/mongoose/issues/12266)
- perf(types): remove extends Query in Schema.pre() and Schema.post(), loosen `discriminator()` generic [#10349](https://redirect.github.com/Automattic/mongoose/issues/10349)
- perf(types): some more micro-optimizations re: [#10349](https://redirect.github.com/Automattic/mongoose/issues/10349), remove extra type checking on $ne, etc.
- fix(types): infer schema on `connection.model()` [#12298](https://redirect.github.com/Automattic/mongoose/issues/12298) [#12125](https://redirect.github.com/Automattic/mongoose/issues/12125) [hasezoey](https://redirect.github.com/hasezoey)
- fix(types): add missing `findById()` type definitions [#12309](https://redirect.github.com/Automattic/mongoose/issues/12309) [lpizzinidev](https://redirect.github.com/lpizzinidev)
- fix(types): allow $search in $lookup pipeline stages for MongoDB v6.x support [#12278](https://redirect.github.com/Autom
This PR contains the following updates:
6.1.6
->6.11.3
By merging this PR, the issue #11 will be automatically resolved and closed:
Release Notes
Automattic/mongoose (mongoose)
### [`v6.11.3`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#6113--2023-07-11) [Compare Source](https://redirect.github.com/Automattic/mongoose/compare/6.11.2...6.11.3) \=================== - fix: avoid prototype pollution on init - fix(schema): correctly handle uuids with populate() [#13317](https://redirect.github.com/Automattic/mongoose/issues/13317) [#13595](https://redirect.github.com/Automattic/mongoose/issues/13595) ### [`v6.11.2`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#6112--2023-06-08) [Compare Source](https://redirect.github.com/Automattic/mongoose/compare/6.11.1...6.11.2) \=================== - fix(cursor): allow find middleware to modify query cursor options [#13476](https://redirect.github.com/Automattic/mongoose/issues/13476) [#13453](https://redirect.github.com/Automattic/mongoose/issues/13453) [#13435](https://redirect.github.com/Automattic/mongoose/issues/13435) ### [`v6.11.1`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#6111--2023-05-08) [Compare Source](https://redirect.github.com/Automattic/mongoose/compare/6.11.0...6.11.1) \=================== - fix(query): apply schema-level paths before calculating projection for findOneAndUpdate() [#13348](https://redirect.github.com/Automattic/mongoose/issues/13348) [#13340](https://redirect.github.com/Automattic/mongoose/issues/13340) - fix: add SUPPRESS_JEST_WARNINGS environment variable to hide jest warnings [#13384](https://redirect.github.com/Automattic/mongoose/issues/13384) [#13373](https://redirect.github.com/Automattic/mongoose/issues/13373) - types(model): allow overwriting expected param type for bulkWrite() [#13292](https://redirect.github.com/Automattic/mongoose/issues/13292) [hasezoey](https://redirect.github.com/hasezoey) ### [`v6.11.0`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#6110--2023-05-01) [Compare Source](https://redirect.github.com/Automattic/mongoose/compare/6.10.5...6.11.0) \=================== - feat: upgrade to mongodb 4.16.0 for Deno+Atlas connection fix [#13337](https://redirect.github.com/Automattic/mongoose/issues/13337) [#13075](https://redirect.github.com/Automattic/mongoose/issues/13075) - perf: speed up creating maps of subdocuments [#13280](https://redirect.github.com/Automattic/mongoose/issues/13280) [#13191](https://redirect.github.com/Automattic/mongoose/issues/13191) [#13271](https://redirect.github.com/Automattic/mongoose/issues/13271) - fix(query): set ObjectParameterError if calling findOneAndX() with filter as non-object [#13338](https://redirect.github.com/Automattic/mongoose/issues/13338) - fix(document): merge Document $inc calls instead of overwriting [#13322](https://redirect.github.com/Automattic/mongoose/issues/13322) - fix(update): handle casting doubly nested arrays with $pullAll [#13285](https://redirect.github.com/Automattic/mongoose/issues/13285) - docs: backport documentation versioning changes to 6.x [#13253](https://redirect.github.com/Automattic/mongoose/issues/13253) [#13190](https://redirect.github.com/Automattic/mongoose/issues/13190) [hasezoey](https://redirect.github.com/hasezoey) ### [`v6.10.5`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#6105--2023-04-06) [Compare Source](https://redirect.github.com/Automattic/mongoose/compare/6.10.4...6.10.5) \=================== - perf(document): avoid unnecessary loops, conditionals, string manipulation on Document.prototype.get() for 10x speedup on top-level properties [#12953](https://redirect.github.com/Automattic/mongoose/issues/12953) - fix(model): execute valid write operations if calling bulkWrite() with ordered: false [#13218](https://redirect.github.com/Automattic/mongoose/issues/13218) [#13176](https://redirect.github.com/Automattic/mongoose/issues/13176) - fix(array): pass-through all parameters [#13202](https://redirect.github.com/Automattic/mongoose/issues/13202) [#13201](https://redirect.github.com/Automattic/mongoose/issues/13201) [hasezoey](https://redirect.github.com/hasezoey) - fix: improve error message when sorting by empty string [#13249](https://redirect.github.com/Automattic/mongoose/issues/13249) [#10182](https://redirect.github.com/Automattic/mongoose/issues/10182) - docs: add version support and check version docs [#13251](https://redirect.github.com/Automattic/mongoose/issues/13251) [#13193](https://redirect.github.com/Automattic/mongoose/issues/13193) ### [`v6.10.4`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#6104--2023-03-21) [Compare Source](https://redirect.github.com/Automattic/mongoose/compare/6.10.3...6.10.4) \=================== - fix(document): apply setters on resulting value when calling Document.prototype.$inc() [#13178](https://redirect.github.com/Automattic/mongoose/issues/13178) [#13158](https://redirect.github.com/Automattic/mongoose/issues/13158) - fix(model): add results property to unordered insertMany() to make it easy to identify exactly which documents were inserted [#13163](https://redirect.github.com/Automattic/mongoose/issues/13163) [#12791](https://redirect.github.com/Automattic/mongoose/issues/12791) - docs(guide+schematypes): add UUID to schematypes guide [#13184](https://redirect.github.com/Automattic/mongoose/issues/13184) ### [`v6.10.3`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#6103--2023-03-13) [Compare Source](https://redirect.github.com/Automattic/mongoose/compare/6.10.2...6.10.3) \=================== - fix(connection): add stub implementation of doClose to base connection class [#13157](https://redirect.github.com/Automattic/mongoose/issues/13157) - fix(types): add cursor.eachAsync index parameter [#13162](https://redirect.github.com/Automattic/mongoose/issues/13162) [#13153](https://redirect.github.com/Automattic/mongoose/issues/13153) [hasezoey](https://redirect.github.com/hasezoey) - docs: fix 6.x docs sidebar links [#13147](https://redirect.github.com/Automattic/mongoose/issues/13147) [#13144](https://redirect.github.com/Automattic/mongoose/issues/13144) [hasezoey](https://redirect.github.com/hasezoey) - docs(validation): clarify that validation runs as first pre(save) middleware [#13062](https://redirect.github.com/Automattic/mongoose/issues/13062) ### [`v6.10.2`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#6102--2023-03-07) [Compare Source](https://redirect.github.com/Automattic/mongoose/compare/6.10.1...6.10.2) \=================== - fix(document): avoid setting array default if document array projected out by sibling projection [#13135](https://redirect.github.com/Automattic/mongoose/issues/13135) [#13043](https://redirect.github.com/Automattic/mongoose/issues/13043) [#13003](https://redirect.github.com/Automattic/mongoose/issues/13003) - fix(documentarray): set correct document array path if making map of document arrays [#13133](https://redirect.github.com/Automattic/mongoose/issues/13133) - fix: undo accidental change to `engines` in `package.json` [#13124](https://redirect.github.com/Automattic/mongoose/issues/13124) [lorand-horvath](https://redirect.github.com/lorand-horvath) - docs: quick improvement to Model.init() docs [#13054](https://redirect.github.com/Automattic/mongoose/issues/13054) ### [`v6.10.1`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#6101--2023-03-03) [Compare Source](https://redirect.github.com/Automattic/mongoose/compare/6.10.0...6.10.1) \=================== - fix: avoid removing empty query filters in `$and` and `$or` [#13086](https://redirect.github.com/Automattic/mongoose/issues/13086) [#12898](https://redirect.github.com/Automattic/mongoose/issues/12898) - fix(schematype): fixed validation for required UUID field [#13018](https://redirect.github.com/Automattic/mongoose/issues/13018) [lpizzinidev](https://redirect.github.com/lpizzinidev) - fix(types): add missing Paths generic param to `Model.populate()` [#13070](https://redirect.github.com/Automattic/mongoose/issues/13070) - docs(migrating_to\_6): added info about removal of reconnectTries and reconnectInterval options [#13083](https://redirect.github.com/Automattic/mongoose/issues/13083) [lpizzinidev](https://redirect.github.com/lpizzinidev) - docs: fix code in headers for migrating_to\_5 [#13077](https://redirect.github.com/Automattic/mongoose/issues/13077) [hasezoey](https://redirect.github.com/hasezoey) - docs: backport misc documentation changes into 6.x [#13091](https://redirect.github.com/Automattic/mongoose/issues/13091) [hasezoey](https://redirect.github.com/hasezoey) ### [`v6.10.0`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#6100--2023-02-22) [Compare Source](https://redirect.github.com/Automattic/mongoose/compare/6.9.3...6.10.0) \=================== - feat: upgrade to mongodb driver 4.14.0 [#13036](https://redirect.github.com/Automattic/mongoose/issues/13036) - feat: added Schema.prototype.omit() function [#12939](https://redirect.github.com/Automattic/mongoose/issues/12939) [#12931](https://redirect.github.com/Automattic/mongoose/issues/12931) [lpizzinidev](https://redirect.github.com/lpizzinidev) - feat(index): added createInitialConnection option to Mongoose constructor [#13021](https://redirect.github.com/Automattic/mongoose/issues/13021) [#12965](https://redirect.github.com/Automattic/mongoose/issues/12965) [lpizzinidev](https://redirect.github.com/lpizzinidev) ### [`v6.9.3`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#693--2023-02-22) [Compare Source](https://redirect.github.com/Automattic/mongoose/compare/6.9.2...6.9.3) \================== - fix(connection): delay calculating `autoCreate` and `autoIndex` until after initial connection established [#13007](https://redirect.github.com/Automattic/mongoose/issues/13007) [#12940](https://redirect.github.com/Automattic/mongoose/issues/12940) [lpizzinidev](https://redirect.github.com/lpizzinidev) - fix(discriminator): allows update doc with discriminatorKey [#13056](https://redirect.github.com/Automattic/mongoose/issues/13056) [#13055](https://redirect.github.com/Automattic/mongoose/issues/13055) [abarriel](https://redirect.github.com/abarriel) - fix(query): avoid sending unnecessary empty projection to MongoDB server [#13059](https://redirect.github.com/Automattic/mongoose/issues/13059) [#13050](https://redirect.github.com/Automattic/mongoose/issues/13050) - fix(model): avoid sending null session option with document operations [#13053](https://redirect.github.com/Automattic/mongoose/issues/13053) [#13052](https://redirect.github.com/Automattic/mongoose/issues/13052) [lpizzinidev](https://redirect.github.com/lpizzinidev) - fix(types): use MergeTypes for type overrides in HydratedDocument [#13066](https://redirect.github.com/Automattic/mongoose/issues/13066) [#13040](https://redirect.github.com/Automattic/mongoose/issues/13040) - docs(middleware): list validate as a potential query middleware [#13057](https://redirect.github.com/Automattic/mongoose/issues/13057) [#12680](https://redirect.github.com/Automattic/mongoose/issues/12680) - docs(getters-setters): explain that getters do not run by default on toJSON() [#13058](https://redirect.github.com/Automattic/mongoose/issues/13058) [#13049](https://redirect.github.com/Automattic/mongoose/issues/13049) - docs: refactor docs generation scripts [#13044](https://redirect.github.com/Automattic/mongoose/issues/13044) [hasezoey](https://redirect.github.com/hasezoey) ### [`v6.9.2`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#692--2023-02-16) [Compare Source](https://redirect.github.com/Automattic/mongoose/compare/6.9.1...6.9.2) \================== - fix(model): fixed post('save') callback parameter [#13030](https://redirect.github.com/Automattic/mongoose/issues/13030) [#13026](https://redirect.github.com/Automattic/mongoose/issues/13026) [lpizzinidev](https://redirect.github.com/lpizzinidev) - fix(UUID): added null check to prevent error on binaryToString conversion [#13034](https://redirect.github.com/Automattic/mongoose/issues/13034) [#13032](https://redirect.github.com/Automattic/mongoose/issues/13032) [#13029](https://redirect.github.com/Automattic/mongoose/issues/13029) [lpizzinidev](https://redirect.github.com/lpizzinidev) [Freezystem](https://redirect.github.com/Freezystem) - fix(query): revert breaking changes introduced by [#12797](https://redirect.github.com/Automattic/mongoose/issues/12797) [#12999](https://redirect.github.com/Automattic/mongoose/issues/12999) [lpizzinidev](https://redirect.github.com/lpizzinidev) - fix(document): make array $shift() use $pop instead of overwriting array [#13004](https://redirect.github.com/Automattic/mongoose/issues/13004) - docs: update & remove old links [#13019](https://redirect.github.com/Automattic/mongoose/issues/13019) [hasezoey](https://redirect.github.com/hasezoey) - docs(middleware): describe how to access model from document middleware [#13031](https://redirect.github.com/Automattic/mongoose/issues/13031) [AxeOfMen](https://redirect.github.com/AxeOfMen) - docs: update broken & outdated links [#13001](https://redirect.github.com/Automattic/mongoose/issues/13001) [hasezoey](https://redirect.github.com/hasezoey) - chore: change deno tests to also use MMS [#12918](https://redirect.github.com/Automattic/mongoose/issues/12918) [hasezoey](https://redirect.github.com/hasezoey) ### [`v6.9.1`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#691--2023-02-06) [Compare Source](https://redirect.github.com/Automattic/mongoose/compare/6.9.0...6.9.1) \================== - fix(document): isModified should not be triggered when setting a nested boolean to the same value as previously [#12994](https://redirect.github.com/Automattic/mongoose/issues/12994) [lpizzinidev](https://redirect.github.com/lpizzinidev) - fix(document): save newly set defaults underneath single nested subdocuments [#13002](https://redirect.github.com/Automattic/mongoose/issues/13002) [#12905](https://redirect.github.com/Automattic/mongoose/issues/12905) - fix(update): handle custom discriminator model name when casting update [#12947](https://redirect.github.com/Automattic/mongoose/issues/12947) [wassil](https://redirect.github.com/wassil) - fix(connection): handles unique autoincrement ID for connections [#12990](https://redirect.github.com/Automattic/mongoose/issues/12990) [lpizzinidev](https://redirect.github.com/lpizzinidev) - fix(types): fix type of options of Model.aggregate [#12933](https://redirect.github.com/Automattic/mongoose/issues/12933) [ghost91-](https://redirect.github.com/ghost91-) - fix(types): fix "near" aggregation operator input type [#12954](https://redirect.github.com/Automattic/mongoose/issues/12954) [Jokero](https://redirect.github.com/Jokero) - fix(types): add missing Top operator to AccumulatorOperator type declaration [#12952](https://redirect.github.com/Automattic/mongoose/issues/12952) [lpizzinidev](https://redirect.github.com/lpizzinidev) - docs(transactions): added example for Connection.transaction() method [#12943](https://redirect.github.com/Automattic/mongoose/issues/12943) [#12934](https://redirect.github.com/Automattic/mongoose/issues/12934) [lpizzinidev](https://redirect.github.com/lpizzinidev) - docs(populate): fix out of date comment referencing onModel property [#13000](https://redirect.github.com/Automattic/mongoose/issues/13000) - docs(transactions): fix typo in transactions.md [#12995](https://redirect.github.com/Automattic/mongoose/issues/12995) [Parth86](https://redirect.github.com/Parth86) ### [`v6.9.0`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#690--2023-01-25) [Compare Source](https://redirect.github.com/Automattic/mongoose/compare/6.8.4...6.9.0) \================== - feat(schema): add removeVirtual(path) function to schema [#12920](https://redirect.github.com/Automattic/mongoose/issues/12920) [IslandRhythms](https://redirect.github.com/IslandRhythms) - fix(cast): remove empty `$or` conditions after strict applied [#12898](https://redirect.github.com/Automattic/mongoose/issues/12898) [0x0a0d](https://redirect.github.com/0x0a0d) - docs: fixed typo [#12946](https://redirect.github.com/Automattic/mongoose/issues/12946) [Gbengstar](https://redirect.github.com/Gbengstar) ### [`v6.8.4`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#684--2023-01-17) [Compare Source](https://redirect.github.com/Automattic/mongoose/compare/6.8.3...6.8.4) \================== - fix(collection): handle creating model when connection disconnected with bufferCommands = false [#12889](https://redirect.github.com/Automattic/mongoose/issues/12889) - fix(populate): merge instead of overwrite when match is on \_id [#12891](https://redirect.github.com/Automattic/mongoose/issues/12891) - fix: add guard to stop loadClass copying Document if Document is used as base of loaded class (same hack as implemented for Model already) [#12820](https://redirect.github.com/Automattic/mongoose/issues/12820) [sgpinkus](https://redirect.github.com/sgpinkus) - fix(types): correctly infer types on document arrays [#12884](https://redirect.github.com/Automattic/mongoose/issues/12884) [#12882](https://redirect.github.com/Automattic/mongoose/issues/12882) [JavaScriptBach](https://redirect.github.com/JavaScriptBach) - fix(types): added omit for ArraySubdocument type in LeanType declaration [#12903](https://redirect.github.com/Automattic/mongoose/issues/12903) [piyushk96](https://redirect.github.com/piyushk96) - fix(types): add returnDocument type safety [#12906](https://redirect.github.com/Automattic/mongoose/issues/12906) [AbdelrahmanHafez](https://redirect.github.com/AbdelrahmanHafez) - docs(typescript): add notes about virtual context to Mongoose 6 migration and TypeScript virtuals docs [#12912](https://redirect.github.com/Automattic/mongoose/issues/12912) [#12806](https://redirect.github.com/Automattic/mongoose/issues/12806) - docs(schematypes): removed dead link and fixed formatting [#12897](https://redirect.github.com/Automattic/mongoose/issues/12897) [#12885](https://redirect.github.com/Automattic/mongoose/issues/12885) [lpizzinidev](https://redirect.github.com/lpizzinidev) - docs: fix link to lean api [#12910](https://redirect.github.com/Automattic/mongoose/issues/12910) [manniL](https://redirect.github.com/manniL) - docs: list all possible strings for schema.pre in one place [#12868](https://redirect.github.com/Automattic/mongoose/issues/12868) - docs: add list of known incompatible npm packages [#12892](https://redirect.github.com/Automattic/mongoose/issues/12892) [IslandRhythms](https://redirect.github.com/IslandRhythms) ### [`v6.8.3`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#683--2023-01-06) [Compare Source](https://redirect.github.com/Automattic/mongoose/compare/6.8.2...6.8.3) \================== - perf: improve performance of assignRawDocsToIdStructure for faster populate on large docs [#12867](https://redirect.github.com/Automattic/mongoose/issues/12867) [Uzlopak](https://redirect.github.com/Uzlopak) - fix(model): ensure consistent ordering of validation errors in insertMany() with ordered: false and rawResult: true [#12866](https://redirect.github.com/Automattic/mongoose/issues/12866) - fix: avoid passing final callback to pre hook, because calling the callback can mess up hook execution [#12836](https://redirect.github.com/Automattic/mongoose/issues/12836) - fix(types): avoid inferring timestamps if methods, virtuals, or statics set [#12871](https://redirect.github.com/Automattic/mongoose/issues/12871) - fix(types): correctly infer string enums on const arrays [#12870](https://redirect.github.com/Automattic/mongoose/issues/12870) [JavaScriptBach](https://redirect.github.com/JavaScriptBach) - fix(types): allow virtuals to be invoked in the definition of other virtuals [#12874](https://redirect.github.com/Automattic/mongoose/issues/12874) [sffc](https://redirect.github.com/sffc) - fix(types): add type def for Aggregate#model without arguments [#12864](https://redirect.github.com/Automattic/mongoose/issues/12864) [hasezoey](https://redirect.github.com/hasezoey) - docs(discriminators): add section about changing discriminator key [#12861](https://redirect.github.com/Automattic/mongoose/issues/12861) - docs(typescript): explain that virtuals inferred from schema only show up on Model, not raw document type [#12860](https://redirect.github.com/Automattic/mongoose/issues/12860) [#12684](https://redirect.github.com/Automattic/mongoose/issues/12684) ### [`v6.8.2`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#682--2022-12-28) [Compare Source](https://redirect.github.com/Automattic/mongoose/compare/6.8.1...6.8.2) \================== - fix(schema): propagate strictQuery to implicitly created schemas for embedded discriminators [#12827](https://redirect.github.com/Automattic/mongoose/issues/12827) [#12796](https://redirect.github.com/Automattic/mongoose/issues/12796) - fix(model): respect discriminators with Model.validate() [#12824](https://redirect.github.com/Automattic/mongoose/issues/12824) [#12621](https://redirect.github.com/Automattic/mongoose/issues/12621) - fix(query): fix unexpected validation error when doing findOneAndReplace() with a nullish value [#12826](https://redirect.github.com/Automattic/mongoose/issues/12826) [#12821](https://redirect.github.com/Automattic/mongoose/issues/12821) - fix(discriminator): apply built-in plugins to discriminator schema even if mergeHooks and mergePlugins are both false [#12833](https://redirect.github.com/Automattic/mongoose/issues/12833) [#12696](https://redirect.github.com/Automattic/mongoose/issues/12696) - fix(types): add option "overwriteModels" as a schema option [#12817](https://redirect.github.com/Automattic/mongoose/issues/12817) [#12816](https://redirect.github.com/Automattic/mongoose/issues/12816) [hasezoey](https://redirect.github.com/hasezoey) - fix(types): add property "defaultOptions" [#12818](https://redirect.github.com/Automattic/mongoose/issues/12818) [hasezoey](https://redirect.github.com/hasezoey) - docs: make search bar respect documentation version, so you can search 5.x docs [#12548](https://redirect.github.com/Automattic/mongoose/issues/12548) - docs(typescript): make note about recommending strict mode when using auto typed schemas [#12825](https://redirect.github.com/Automattic/mongoose/issues/12825) [#12420](https://redirect.github.com/Automattic/mongoose/issues/12420) - docs: add section on sorting to query docs [#12588](https://redirect.github.com/Automattic/mongoose/issues/12588) [IslandRhythms](https://redirect.github.com/IslandRhythms) - test(query.test): add write-concern option [#12829](https://redirect.github.com/Automattic/mongoose/issues/12829) [hasezoey](https://redirect.github.com/hasezoey) ### [`v6.8.1`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#681--2022-12-19) [Compare Source](https://redirect.github.com/Automattic/mongoose/compare/6.8.0...6.8.1) \================== - fix(query): avoid throwing circular dependency error if same object is used in multiple properties [#12774](https://redirect.github.com/Automattic/mongoose/issues/12774) [orgads](https://redirect.github.com/orgads) - fix(map): return value from super.delete() [#12777](https://redirect.github.com/Automattic/mongoose/issues/12777) [danbrud](https://redirect.github.com/danbrud) - fix(populate): handle virtual populate underneath document array with justOne=true and sort set where 1 element has only 1 result [#12815](https://redirect.github.com/Automattic/mongoose/issues/12815) [#12730](https://redirect.github.com/Automattic/mongoose/issues/12730) - fix(update): handle embedded discriminators when casting array filters [#12802](https://redirect.github.com/Automattic/mongoose/issues/12802) [#12565](https://redirect.github.com/Automattic/mongoose/issues/12565) - fix(populate): avoid calling transform if there's no populate results and using lean [#12804](https://redirect.github.com/Automattic/mongoose/issues/12804) [#12739](https://redirect.github.com/Automattic/mongoose/issues/12739) - fix(model): prevent index creation on syncIndexes if not necessary [#12785](https://redirect.github.com/Automattic/mongoose/issues/12785) [#12250](https://redirect.github.com/Automattic/mongoose/issues/12250) [lpizzinidev](https://redirect.github.com/lpizzinidev) - fix(types): correctly infer this when using pre('updateOne') with { document: true, query: false } [#12778](https://redirect.github.com/Automattic/mongoose/issues/12778) - fix(types): make InferSchemaType: consider { required: boolean } required if it isn't explicitly false [#12784](https://redirect.github.com/Automattic/mongoose/issues/12784) [JavaScriptBach](https://redirect.github.com/JavaScriptBach) - docs: replace many occurrences of "localhost" with "127.0.0.1" [#12811](https://redirect.github.com/Automattic/mongoose/issues/12811) [#12741](https://redirect.github.com/Automattic/mongoose/issues/12741) [hasezoey](https://redirect.github.com/hasezoey) [SadiqOnGithub](https://redirect.github.com/SadiqOnGithub) - docs(mongoose): Added missing options to set [#12810](https://redirect.github.com/Automattic/mongoose/issues/12810) [lpizzinidev](https://redirect.github.com/lpizzinidev) - docs: add info on `$locals` parameters to getters/setters tutorial [#12814](https://redirect.github.com/Automattic/mongoose/issues/12814) [#12550](https://redirect.github.com/Automattic/mongoose/issues/12550) [IslandRhythms](https://redirect.github.com/IslandRhythms) - docs: make Document.prototype.$clone() public [#12803](https://redirect.github.com/Automattic/mongoose/issues/12803) - docs(query): updated explanation for slice [#12776](https://redirect.github.com/Automattic/mongoose/issues/12776) [#12474](https://redirect.github.com/Automattic/mongoose/issues/12474) [lpizzinidev](https://redirect.github.com/lpizzinidev) - docs(middleware): fix broken links [#12787](https://redirect.github.com/Automattic/mongoose/issues/12787) [lpizzinidev](https://redirect.github.com/lpizzinidev) - docs(queries): fixed broken links [#12790](https://redirect.github.com/Automattic/mongoose/issues/12790) [lpizzinidev](https://redirect.github.com/lpizzinidev) ### [`v6.8.0`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#680--2022-12-05) [Compare Source](https://redirect.github.com/Automattic/mongoose/compare/6.7.5...6.8.0) \================== - feat: add alpha support for Deno [#12397](https://redirect.github.com/Automattic/mongoose/issues/12397) [#9056](https://redirect.github.com/Automattic/mongoose/issues/9056) - feat: add deprecation warning for default strictQuery [#12666](https://redirect.github.com/Automattic/mongoose/issues/12666) - feat: upgrade to MongoDB driver 4.12.1 - feat(schema): add doc as second params to validation message function [#12564](https://redirect.github.com/Automattic/mongoose/issues/12564) [#12651](https://redirect.github.com/Automattic/mongoose/issues/12651) [IslandRhythms](https://redirect.github.com/IslandRhythms) - feat(document): add $clone method [#12549](https://redirect.github.com/Automattic/mongoose/issues/12549) [#11849](https://redirect.github.com/Automattic/mongoose/issues/11849) [lpizzinidev](https://redirect.github.com/lpizzinidev) - feat(populate): allow overriding `localField` and `foreignField` for virtual populate [#12657](https://redirect.github.com/Automattic/mongoose/issues/12657) [#6963](https://redirect.github.com/Automattic/mongoose/issues/6963) [IslandRhythms](https://redirect.github.com/IslandRhythms) - feat(schema+types): add { errorHandler: true } option to Schema post() for better TypeScript support [#12723](https://redirect.github.com/Automattic/mongoose/issues/12723) [#12583](https://redirect.github.com/Automattic/mongoose/issues/12583) - feat(debug): allow setting debug on a per-connection basis [#12704](https://redirect.github.com/Automattic/mongoose/issues/12704) [#12700](https://redirect.github.com/Automattic/mongoose/issues/12700) [lpizzinidev](https://redirect.github.com/lpizzinidev) - feat: add rewind function to QueryCursor [#12710](https://redirect.github.com/Automattic/mongoose/issues/12710) [passabilities](https://redirect.github.com/passabilities) - feat(types): infer timestamps option from schema [#12731](https://redirect.github.com/Automattic/mongoose/issues/12731) [#12069](https://redirect.github.com/Automattic/mongoose/issues/12069) - docs: change links to not link to api.html anymore [#12644](https://redirect.github.com/Automattic/mongoose/issues/12644) [hasezoey](https://redirect.github.com/hasezoey) ### [`v6.7.5`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#675--2022-11-30) [Compare Source](https://redirect.github.com/Automattic/mongoose/compare/6.7.4...6.7.5) \================== - fix(schema): copy indexes when calling add() with schema instance [#12737](https://redirect.github.com/Automattic/mongoose/issues/12737) [#12654](https://redirect.github.com/Automattic/mongoose/issues/12654) - fix(query): handle deselecting \_id when another field has schema-level select: false [#12736](https://redirect.github.com/Automattic/mongoose/issues/12736) [#12670](https://redirect.github.com/Automattic/mongoose/issues/12670) - fix(types): support using UpdateQuery in bulkWrite() [#12742](https://redirect.github.com/Automattic/mongoose/issues/12742) [#12595](https://redirect.github.com/Automattic/mongoose/issues/12595) - docs(middleware): added note about execution policy on subdocuments [#12735](https://redirect.github.com/Automattic/mongoose/issues/12735) [#12694](https://redirect.github.com/Automattic/mongoose/issues/12694) [lpizzinidev](https://redirect.github.com/lpizzinidev) - docs(validation): clarify context for update validators in validation docs [#12738](https://redirect.github.com/Automattic/mongoose/issues/12738) [#12655](https://redirect.github.com/Automattic/mongoose/issues/12655) [IslandRhythms](https://redirect.github.com/IslandRhythms) ### [`v6.7.4`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#674--2022-11-28) [Compare Source](https://redirect.github.com/Automattic/mongoose/compare/6.7.3...6.7.4) \================== - fix: allow setting global strictQuery after Schema creation [#12717](https://redirect.github.com/Automattic/mongoose/issues/12717) [#12703](https://redirect.github.com/Automattic/mongoose/issues/12703) [lpizzinidev](https://redirect.github.com/lpizzinidev) - fix(cursor): make eachAsync() avoid modifying batch when mixing parallel and batchSize [#12716](https://redirect.github.com/Automattic/mongoose/issues/12716) - fix(types): infer virtuals in query results [#12727](https://redirect.github.com/Automattic/mongoose/issues/12727) [#12702](https://redirect.github.com/Automattic/mongoose/issues/12702) [#12684](https://redirect.github.com/Automattic/mongoose/issues/12684) - fix(types): correctly infer ReadonlyArray types in schema definitions [#12720](https://redirect.github.com/Automattic/mongoose/issues/12720) - fix(types): avoid typeof Query with generics for TypeScript 4.6 support [#12712](https://redirect.github.com/Automattic/mongoose/issues/12712) [#12688](https://redirect.github.com/Automattic/mongoose/issues/12688) - chore: avoid bundling .tgz files when publishing [#12725](https://redirect.github.com/Automattic/mongoose/issues/12725) [hasezoey](https://redirect.github.com/hasezoey) ### [`v6.7.3`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#673--2022-11-22) [Compare Source](https://redirect.github.com/Automattic/mongoose/compare/6.7.2...6.7.3) \================== - fix(document): handle setting array to itself after saving and pushing a new value [#12672](https://redirect.github.com/Automattic/mongoose/issues/12672) [#12656](https://redirect.github.com/Automattic/mongoose/issues/12656) - fix(types): update replaceWith pipeline stage [#12715](https://redirect.github.com/Automattic/mongoose/issues/12715) [coyotte508](https://redirect.github.com/coyotte508) - fix(types): remove incorrect modelName type definition [#12682](https://redirect.github.com/Automattic/mongoose/issues/12682) [#12669](https://redirect.github.com/Automattic/mongoose/issues/12669) [lpizzinidev](https://redirect.github.com/lpizzinidev) - fix(schema): fix setupTimestamps for browser.umd [#12683](https://redirect.github.com/Automattic/mongoose/issues/12683) [raphael-papazikas](https://redirect.github.com/raphael-papazikas) - docs: correct justOne description [#12686](https://redirect.github.com/Automattic/mongoose/issues/12686) [#12599](https://redirect.github.com/Automattic/mongoose/issues/12599) [tianguangcn](https://redirect.github.com/tianguangcn) - docs: make links more consistent [#12690](https://redirect.github.com/Automattic/mongoose/issues/12690) [#12645](https://redirect.github.com/Automattic/mongoose/issues/12645) [hasezoey](https://redirect.github.com/hasezoey) - docs(document): explain that $isNew is false in post('save') hooks [#12685](https://redirect.github.com/Automattic/mongoose/issues/12685) [#11990](https://redirect.github.com/Automattic/mongoose/issues/11990) - docs: fixed line causing a "used before defined" linting error [#12707](https://redirect.github.com/Automattic/mongoose/issues/12707) [sgpinkus](https://redirect.github.com/sgpinkus) ### [`v6.7.2`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#672--2022-11-07) [Compare Source](https://redirect.github.com/Automattic/mongoose/compare/6.7.1...6.7.2) \================== - fix(discriminator): skip copying base schema plugins if `applyPlugins == false` [#12613](https://redirect.github.com/Automattic/mongoose/issues/12613) [#12604](https://redirect.github.com/Automattic/mongoose/issues/12604) [lpizzinidev](https://redirect.github.com/lpizzinidev) - fix(types): add UUID to types [#12650](https://redirect.github.com/Automattic/mongoose/issues/12650) [#12593](https://redirect.github.com/Automattic/mongoose/issues/12593) - fix(types): allow setting SchemaTypeOptions' index property to IndexOptions [#12562](https://redirect.github.com/Automattic/mongoose/issues/12562) - fix(types): set this to doc type in SchemaType.prototype.validate() [#12663](https://redirect.github.com/Automattic/mongoose/issues/12663) [#12590](https://redirect.github.com/Automattic/mongoose/issues/12590) - fix(types): correct handling for model