Mongoose is a MongoDB object modeling tool designed to work in an asynchronous environment. Affected versions of this package are vulnerable to Prototype Pollution. The Schema.path() function is vulnerable to prototype pollution when setting the schema object. This vulnerability allows modification of the Object prototype and could be manipulated into a Denial of Service (DoS) attack.
Mongoose is a MongoDB object modeling tool designed to work in an asynchronous environment.
Affected versions of this package are vulnerable to Prototype Pollution. The Schema.path() function is vulnerable to prototype pollution when setting the schema object. This vulnerability allows modification of the Object prototype and could be manipulated into a Denial of Service (DoS) attack.
Proof of Concept
// poc.js
const mongoose = require('mongoose');
const schema = new mongoose.Schema();
malicious_payload = '__proto__.toString'
schema.path(malicious_payload, [String])
x = {}
console.log(x.toString()) // crashed (Denial of service (DoS) attack)
Impact
This vulnerability can be manipulated to exploit other types of attacks, such as Denial of service (DoS), Remote Code Execution, or Property Injection.
Release Notes
Automattic/mongoose (mongoose)
### [`v6.11.3`](https://togithub.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#6113--2023-07-11)
[Compare Source](https://togithub.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://togithub.com/Automattic/mongoose/issues/13317) [#13595](https://togithub.com/Automattic/mongoose/issues/13595)
### [`v6.11.2`](https://togithub.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#6112--2023-06-08)
[Compare Source](https://togithub.com/Automattic/mongoose/compare/6.11.1...6.11.2)
\===================
- fix(cursor): allow find middleware to modify query cursor options [#13476](https://togithub.com/Automattic/mongoose/issues/13476) [#13453](https://togithub.com/Automattic/mongoose/issues/13453) [#13435](https://togithub.com/Automattic/mongoose/issues/13435)
### [`v6.11.1`](https://togithub.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#6111--2023-05-08)
[Compare Source](https://togithub.com/Automattic/mongoose/compare/6.11.0...6.11.1)
\===================
- fix(query): apply schema-level paths before calculating projection for findOneAndUpdate() [#13348](https://togithub.com/Automattic/mongoose/issues/13348) [#13340](https://togithub.com/Automattic/mongoose/issues/13340)
- fix: add SUPPRESS_JEST_WARNINGS environment variable to hide jest warnings [#13384](https://togithub.com/Automattic/mongoose/issues/13384) [#13373](https://togithub.com/Automattic/mongoose/issues/13373)
- types(model): allow overwriting expected param type for bulkWrite() [#13292](https://togithub.com/Automattic/mongoose/issues/13292) [hasezoey](https://togithub.com/hasezoey)
### [`v6.11.0`](https://togithub.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#6110--2023-05-01)
[Compare Source](https://togithub.com/Automattic/mongoose/compare/6.10.5...6.11.0)
\===================
- feat: upgrade to mongodb 4.16.0 for Deno+Atlas connection fix [#13337](https://togithub.com/Automattic/mongoose/issues/13337) [#13075](https://togithub.com/Automattic/mongoose/issues/13075)
- perf: speed up creating maps of subdocuments [#13280](https://togithub.com/Automattic/mongoose/issues/13280) [#13191](https://togithub.com/Automattic/mongoose/issues/13191) [#13271](https://togithub.com/Automattic/mongoose/issues/13271)
- fix(query): set ObjectParameterError if calling findOneAndX() with filter as non-object [#13338](https://togithub.com/Automattic/mongoose/issues/13338)
- fix(document): merge Document $inc calls instead of overwriting [#13322](https://togithub.com/Automattic/mongoose/issues/13322)
- fix(update): handle casting doubly nested arrays with $pullAll [#13285](https://togithub.com/Automattic/mongoose/issues/13285)
- docs: backport documentation versioning changes to 6.x [#13253](https://togithub.com/Automattic/mongoose/issues/13253) [#13190](https://togithub.com/Automattic/mongoose/issues/13190) [hasezoey](https://togithub.com/hasezoey)
### [`v6.10.5`](https://togithub.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#6105--2023-04-06)
[Compare Source](https://togithub.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://togithub.com/Automattic/mongoose/issues/12953)
- fix(model): execute valid write operations if calling bulkWrite() with ordered: false [#13218](https://togithub.com/Automattic/mongoose/issues/13218) [#13176](https://togithub.com/Automattic/mongoose/issues/13176)
- fix(array): pass-through all parameters [#13202](https://togithub.com/Automattic/mongoose/issues/13202) [#13201](https://togithub.com/Automattic/mongoose/issues/13201) [hasezoey](https://togithub.com/hasezoey)
- fix: improve error message when sorting by empty string [#13249](https://togithub.com/Automattic/mongoose/issues/13249) [#10182](https://togithub.com/Automattic/mongoose/issues/10182)
- docs: add version support and check version docs [#13251](https://togithub.com/Automattic/mongoose/issues/13251) [#13193](https://togithub.com/Automattic/mongoose/issues/13193)
### [`v6.10.4`](https://togithub.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#6104--2023-03-21)
[Compare Source](https://togithub.com/Automattic/mongoose/compare/6.10.3...6.10.4)
\===================
- fix(document): apply setters on resulting value when calling Document.prototype.$inc() [#13178](https://togithub.com/Automattic/mongoose/issues/13178) [#13158](https://togithub.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://togithub.com/Automattic/mongoose/issues/13163) [#12791](https://togithub.com/Automattic/mongoose/issues/12791)
- docs(guide+schematypes): add UUID to schematypes guide [#13184](https://togithub.com/Automattic/mongoose/issues/13184)
### [`v6.10.3`](https://togithub.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#6103--2023-03-13)
[Compare Source](https://togithub.com/Automattic/mongoose/compare/6.10.2...6.10.3)
\===================
- fix(connection): add stub implementation of doClose to base connection class [#13157](https://togithub.com/Automattic/mongoose/issues/13157)
- fix(types): add cursor.eachAsync index parameter [#13162](https://togithub.com/Automattic/mongoose/issues/13162) [#13153](https://togithub.com/Automattic/mongoose/issues/13153) [hasezoey](https://togithub.com/hasezoey)
- docs: fix 6.x docs sidebar links [#13147](https://togithub.com/Automattic/mongoose/issues/13147) [#13144](https://togithub.com/Automattic/mongoose/issues/13144) [hasezoey](https://togithub.com/hasezoey)
- docs(validation): clarify that validation runs as first pre(save) middleware [#13062](https://togithub.com/Automattic/mongoose/issues/13062)
### [`v6.10.2`](https://togithub.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#6102--2023-03-07)
[Compare Source](https://togithub.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://togithub.com/Automattic/mongoose/issues/13135) [#13043](https://togithub.com/Automattic/mongoose/issues/13043) [#13003](https://togithub.com/Automattic/mongoose/issues/13003)
- fix(documentarray): set correct document array path if making map of document arrays [#13133](https://togithub.com/Automattic/mongoose/issues/13133)
- fix: undo accidental change to `engines` in `package.json` [#13124](https://togithub.com/Automattic/mongoose/issues/13124) [lorand-horvath](https://togithub.com/lorand-horvath)
- docs: quick improvement to Model.init() docs [#13054](https://togithub.com/Automattic/mongoose/issues/13054)
### [`v6.10.1`](https://togithub.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#6101--2023-03-03)
[Compare Source](https://togithub.com/Automattic/mongoose/compare/6.10.0...6.10.1)
\===================
- fix: avoid removing empty query filters in `$and` and `$or` [#13086](https://togithub.com/Automattic/mongoose/issues/13086) [#12898](https://togithub.com/Automattic/mongoose/issues/12898)
- fix(schematype): fixed validation for required UUID field [#13018](https://togithub.com/Automattic/mongoose/issues/13018) [lpizzinidev](https://togithub.com/lpizzinidev)
- fix(types): add missing Paths generic param to `Model.populate()` [#13070](https://togithub.com/Automattic/mongoose/issues/13070)
- docs(migrating_to\_6): added info about removal of reconnectTries and reconnectInterval options [#13083](https://togithub.com/Automattic/mongoose/issues/13083) [lpizzinidev](https://togithub.com/lpizzinidev)
- docs: fix code in headers for migrating_to\_5 [#13077](https://togithub.com/Automattic/mongoose/issues/13077) [hasezoey](https://togithub.com/hasezoey)
- docs: backport misc documentation changes into 6.x [#13091](https://togithub.com/Automattic/mongoose/issues/13091) [hasezoey](https://togithub.com/hasezoey)
### [`v6.10.0`](https://togithub.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#6100--2023-02-22)
[Compare Source](https://togithub.com/Automattic/mongoose/compare/6.9.3...6.10.0)
\===================
- feat: upgrade to mongodb driver 4.14.0 [#13036](https://togithub.com/Automattic/mongoose/issues/13036)
- feat: added Schema.prototype.omit() function [#12939](https://togithub.com/Automattic/mongoose/issues/12939) [#12931](https://togithub.com/Automattic/mongoose/issues/12931) [lpizzinidev](https://togithub.com/lpizzinidev)
- feat(index): added createInitialConnection option to Mongoose constructor [#13021](https://togithub.com/Automattic/mongoose/issues/13021) [#12965](https://togithub.com/Automattic/mongoose/issues/12965) [lpizzinidev](https://togithub.com/lpizzinidev)
### [`v6.9.3`](https://togithub.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#693--2023-02-22)
[Compare Source](https://togithub.com/Automattic/mongoose/compare/6.9.2...6.9.3)
\==================
- fix(connection): delay calculating `autoCreate` and `autoIndex` until after initial connection established [#13007](https://togithub.com/Automattic/mongoose/issues/13007) [#12940](https://togithub.com/Automattic/mongoose/issues/12940) [lpizzinidev](https://togithub.com/lpizzinidev)
- fix(discriminator): allows update doc with discriminatorKey [#13056](https://togithub.com/Automattic/mongoose/issues/13056) [#13055](https://togithub.com/Automattic/mongoose/issues/13055) [abarriel](https://togithub.com/abarriel)
- fix(query): avoid sending unnecessary empty projection to MongoDB server [#13059](https://togithub.com/Automattic/mongoose/issues/13059) [#13050](https://togithub.com/Automattic/mongoose/issues/13050)
- fix(model): avoid sending null session option with document operations [#13053](https://togithub.com/Automattic/mongoose/issues/13053) [#13052](https://togithub.com/Automattic/mongoose/issues/13052) [lpizzinidev](https://togithub.com/lpizzinidev)
- fix(types): use MergeTypes for type overrides in HydratedDocument [#13066](https://togithub.com/Automattic/mongoose/issues/13066) [#13040](https://togithub.com/Automattic/mongoose/issues/13040)
- docs(middleware): list validate as a potential query middleware [#13057](https://togithub.com/Automattic/mongoose/issues/13057) [#12680](https://togithub.com/Automattic/mongoose/issues/12680)
- docs(getters-setters): explain that getters do not run by default on toJSON() [#13058](https://togithub.com/Automattic/mongoose/issues/13058) [#13049](https://togithub.com/Automattic/mongoose/issues/13049)
- docs: refactor docs generation scripts [#13044](https://togithub.com/Automattic/mongoose/issues/13044) [hasezoey](https://togithub.com/hasezoey)
### [`v6.9.2`](https://togithub.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#692--2023-02-16)
[Compare Source](https://togithub.com/Automattic/mongoose/compare/6.9.1...6.9.2)
\==================
- fix(model): fixed post('save') callback parameter [#13030](https://togithub.com/Automattic/mongoose/issues/13030) [#13026](https://togithub.com/Automattic/mongoose/issues/13026) [lpizzinidev](https://togithub.com/lpizzinidev)
- fix(UUID): added null check to prevent error on binaryToString conversion [#13034](https://togithub.com/Automattic/mongoose/issues/13034) [#13032](https://togithub.com/Automattic/mongoose/issues/13032) [#13029](https://togithub.com/Automattic/mongoose/issues/13029) [lpizzinidev](https://togithub.com/lpizzinidev) [Freezystem](https://togithub.com/Freezystem)
- fix(query): revert breaking changes introduced by [#12797](https://togithub.com/Automattic/mongoose/issues/12797) [#12999](https://togithub.com/Automattic/mongoose/issues/12999) [lpizzinidev](https://togithub.com/lpizzinidev)
- fix(document): make array $shift() use $pop instead of overwriting array [#13004](https://togithub.com/Automattic/mongoose/issues/13004)
- docs: update & remove old links [#13019](https://togithub.com/Automattic/mongoose/issues/13019) [hasezoey](https://togithub.com/hasezoey)
- docs(middleware): describe how to access model from document middleware [#13031](https://togithub.com/Automattic/mongoose/issues/13031) [AxeOfMen](https://togithub.com/AxeOfMen)
- docs: update broken & outdated links [#13001](https://togithub.com/Automattic/mongoose/issues/13001) [hasezoey](https://togithub.com/hasezoey)
- chore: change deno tests to also use MMS [#12918](https://togithub.com/Automattic/mongoose/issues/12918) [hasezoey](https://togithub.com/hasezoey)
### [`v6.9.1`](https://togithub.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#691--2023-02-06)
[Compare Source](https://togithub.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://togithub.com/Automattic/mongoose/issues/12994) [lpizzinidev](https://togithub.com/lpizzinidev)
- fix(document): save newly set defaults underneath single nested subdocuments [#13002](https://togithub.com/Automattic/mongoose/issues/13002) [#12905](https://togithub.com/Automattic/mongoose/issues/12905)
- fix(update): handle custom discriminator model name when casting update [#12947](https://togithub.com/Automattic/mongoose/issues/12947) [wassil](https://togithub.com/wassil)
- fix(connection): handles unique autoincrement ID for connections [#12990](https://togithub.com/Automattic/mongoose/issues/12990) [lpizzinidev](https://togithub.com/lpizzinidev)
- fix(types): fix type of options of Model.aggregate [#12933](https://togithub.com/Automattic/mongoose/issues/12933) [ghost91-](https://togithub.com/ghost91-)
- fix(types): fix "near" aggregation operator input type [#12954](https://togithub.com/Automattic/mongoose/issues/12954) [Jokero](https://togithub.com/Jokero)
- fix(types): add missing Top operator to AccumulatorOperator type declaration [#12952](https://togithub.com/Automattic/mongoose/issues/12952) [lpizzinidev](https://togithub.com/lpizzinidev)
- docs(transactions): added example for Connection.transaction() method [#12943](https://togithub.com/Automattic/mongoose/issues/12943) [#12934](https://togithub.com/Automattic/mongoose/issues/12934) [lpizzinidev](https://togithub.com/lpizzinidev)
- docs(populate): fix out of date comment referencing onModel property [#13000](https://togithub.com/Automattic/mongoose/issues/13000)
- docs(transactions): fix typo in transactions.md [#12995](https://togithub.com/Automattic/mongoose/issues/12995) [Parth86](https://togithub.com/Parth86)
### [`v6.9.0`](https://togithub.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#690--2023-01-25)
[Compare Source](https://togithub.com/Automattic/mongoose/compare/6.8.4...6.9.0)
\==================
- feat(schema): add removeVirtual(path) function to schema [#12920](https://togithub.com/Automattic/mongoose/issues/12920) [IslandRhythms](https://togithub.com/IslandRhythms)
- fix(cast): remove empty `$or` conditions after strict applied [#12898](https://togithub.com/Automattic/mongoose/issues/12898) [0x0a0d](https://togithub.com/0x0a0d)
- docs: fixed typo [#12946](https://togithub.com/Automattic/mongoose/issues/12946) [Gbengstar](https://togithub.com/Gbengstar)
### [`v6.8.4`](https://togithub.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#684--2023-01-17)
[Compare Source](https://togithub.com/Automattic/mongoose/compare/6.8.3...6.8.4)
\==================
- fix(collection): handle creating model when connection disconnected with bufferCommands = false [#12889](https://togithub.com/Automattic/mongoose/issues/12889)
- fix(populate): merge instead of overwrite when match is on \_id [#12891](https://togithub.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://togithub.com/Automattic/mongoose/issues/12820) [sgpinkus](https://togithub.com/sgpinkus)
- fix(types): correctly infer types on document arrays [#12884](https://togithub.com/Automattic/mongoose/issues/12884) [#12882](https://togithub.com/Automattic/mongoose/issues/12882) [JavaScriptBach](https://togithub.com/JavaScriptBach)
- fix(types): added omit for ArraySubdocument type in LeanType declaration [#12903](https://togithub.com/Automattic/mongoose/issues/12903) [piyushk96](https://togithub.com/piyushk96)
- fix(types): add returnDocument type safety [#12906](https://togithub.com/Automattic/mongoose/issues/12906) [AbdelrahmanHafez](https://togithub.com/AbdelrahmanHafez)
- docs(typescript): add notes about virtual context to Mongoose 6 migration and TypeScript virtuals docs [#12912](https://togithub.com/Automattic/mongoose/issues/12912) [#12806](https://togithub.com/Automattic/mongoose/issues/12806)
- docs(schematypes): removed dead link and fixed formatting [#12897](https://togithub.com/Automattic/mongoose/issues/12897) [#12885](https://togithub.com/Automattic/mongoose/issues/12885) [lpizzinidev](https://togithub.com/lpizzinidev)
- docs: fix link to lean api [#12910](https://togithub.com/Automattic/mongoose/issues/12910) [manniL](https://togithub.com/manniL)
- docs: list all possible strings for schema.pre in one place [#12868](https://togithub.com/Automattic/mongoose/issues/12868)
- docs: add list of known incompatible npm packages [#12892](https://togithub.com/Automattic/mongoose/issues/12892) [IslandRhythms](https://togithub.com/IslandRhythms)
### [`v6.8.3`](https://togithub.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#683--2023-01-06)
[Compare Source](https://togithub.com/Automattic/mongoose/compare/6.8.2...6.8.3)
\==================
- perf: improve performance of assignRawDocsToIdStructure for faster populate on large docs [#12867](https://togithub.com/Automattic/mongoose/issues/12867) [Uzlopak](https://togithub.com/Uzlopak)
- fix(model): ensure consistent ordering of validation errors in insertMany() with ordered: false and rawResult: true [#12866](https://togithub.com/Automattic/mongoose/issues/12866)
- fix: avoid passing final callback to pre hook, because calling the callback can mess up hook execution [#12836](https://togithub.com/Automattic/mongoose/issues/12836)
- fix(types): avoid inferring timestamps if methods, virtuals, or statics set [#12871](https://togithub.com/Automattic/mongoose/issues/12871)
- fix(types): correctly infer string enums on const arrays [#12870](https://togithub.com/Automattic/mongoose/issues/12870) [JavaScriptBach](https://togithub.com/JavaScriptBach)
- fix(types): allow virtuals to be invoked in the definition of other virtuals [#12874](https://togithub.com/Automattic/mongoose/issues/12874) [sffc](https://togithub.com/sffc)
- fix(types): add type def for Aggregate#model without arguments [#12864](https://togithub.com/Automattic/mongoose/issues/12864) [hasezoey](https://togithub.com/hasezoey)
- docs(discriminators): add section about changing discriminator key [#12861](https://togithub.com/Automattic/mongoose/issues/12861)
- docs(typescript): explain that virtuals inferred from schema only show up on Model, not raw document type [#12860](https://togithub.com/Automattic/mongoose/issues/12860) [#12684](https://togithub.com/Automattic/mongoose/issues/12684)
### [`v6.8.2`](https://togithub.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#682--2022-12-28)
[Compare Source](https://togithub.com/Automattic/mongoose/compare/6.8.1...6.8.2)
\==================
- fix(schema): propagate strictQuery to implicitly created schemas for embedded discriminators [#12827](https://togithub.com/Automattic/mongoose/issues/12827) [#12796](https://togithub.com/Automattic/mongoose/issues/12796)
- fix(model): respect discriminators with Model.validate() [#12824](https://togithub.com/Automattic/mongoose/issues/12824) [#12621](https://togithub.com/Automattic/mongoose/issues/12621)
- fix(query): fix unexpected validation error when doing findOneAndReplace() with a nullish value [#12826](https://togithub.com/Automattic/mongoose/issues/12826) [#12821](https://togithub.com/Automattic/mongoose/issues/12821)
- fix(discriminator): apply built-in plugins to discriminator schema even if mergeHooks and mergePlugins are both false [#12833](https://togithub.com/Automattic/mongoose/issues/12833) [#12696](https://togithub.com/Automattic/mongoose/issues/12696)
- fix(types): add option "overwriteModels" as a schema option [#12817](https://togithub.com/Automattic/mongoose/issues/12817) [#12816](https://togithub.com/Automattic/mongoose/issues/12816) [hasezoey](https://togithub.com/hasezoey)
- fix(types): add property "defaultOptions" [#12818](https://togithub.com/Automattic/mongoose/issues/12818) [hasezoey](https://togithub.com/hasezoey)
- docs: make search bar respect documentation version, so you can search 5.x docs [#12548](https://togithub.com/Automattic/mongoose/issues/12548)
- docs(typescript): make note about recommending strict mode when using auto typed schemas [#12825](https://togithub.com/Automattic/mongoose/issues/12825) [#12420](https://togithub.com/Automattic/mongoose/issues/12420)
- docs: add section on sorting to query docs [#12588](https://togithub.com/Automattic/mongoose/issues/12588) [IslandRhythms](https://togithub.com/IslandRhythms)
- test(query.test): add write-concern option [#12829](https://togithub.com/Automattic/mongoose/issues/12829) [hasezoey](https://togithub.com/hasezoey)
### [`v6.8.1`](https://togithub.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#681--2022-12-19)
[Compare Source](https://togithub.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://togithub.com/Automattic/mongoose/issues/12774) [orgads](https://togithub.com/orgads)
- fix(map): return value from super.delete() [#12777](https://togithub.com/Automattic/mongoose/issues/12777) [danbrud](https://togithub.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://togithub.com/Automattic/mongoose/issues/12815) [#12730](https://togithub.com/Automattic/mongoose/issues/12730)
- fix(update): handle embedded discriminators when casting array filters [#12802](https://togithub.com/Automattic/mongoose/issues/12802) [#12565](https://togithub.com/Automattic/mongoose/issues/12565)
- fix(populate): avoid calling transform if there's no populate results and using lean [#12804](https://togithub.com/Automattic/mongoose/issues/12804) [#12739](https://togithub.com/Automattic/mongoose/issues/12739)
- fix(model): prevent index creation on syncIndexes if not necessary [#12785](https://togithub.com/Automattic/mongoose/issues/12785) [#12250](https://togithub.com/Automattic/mongoose/issues/12250) [lpizzinidev](https://togithub.com/lpizzinidev)
- fix(types): correctly infer this when using pre('updateOne') with { document: true, query: false } [#12778](https://togithub.com/Automattic/mongoose/issues/12778)
- fix(types): make InferSchemaType: consider { required: boolean } required if it isn't explicitly false [#12784](https://togithub.com/Automattic/mongoose/issues/12784) [JavaScriptBach](https://togithub.com/JavaScriptBach)
- docs: replace many occurrences of "localhost" with "127.0.0.1" [#12811](https://togithub.com/Automattic/mongoose/issues/12811) [#12741](https://togithub.com/Automattic/mongoose/issues/12741) [hasezoey](https://togithub.com/hasezoey) [SadiqOnGithub](https://togithub.com/SadiqOnGithub)
- docs(mongoose): Added missing options to set [#12810](https://togithub.com/Automattic/mongoose/issues/12810) [lpizzinidev](https://togithub.com/lpizzinidev)
- docs: add info on `$locals` parameters to getters/setters tutorial [#12814](https://togithub.com/Automattic/mongoose/issues/12814) [#12550](https://togithub.com/Automattic/mongoose/issues/12550) [IslandRhythms](https://togithub.com/IslandRhythms)
- docs: make Document.prototype.$clone() public [#12803](https://togithub.com/Automattic/mongoose/issues/12803)
- docs(query): updated explanation for slice [#12776](https://togithub.com/Automattic/mongoose/issues/12776) [#12474](https://togithub.com/Automattic/mongoose/issues/12474) [lpizzinidev](https://togithub.com/lpizzinidev)
- docs(middleware): fix broken links [#12787](https://togithub.com/Automattic/mongoose/issues/12787) [lpizzinidev](https://togithub.com/lpizzinidev)
- docs(queries): fixed broken links [#12790](https://togithub.com/Automattic/mongoose/issues/12790) [lpizzinidev](https://togithub.com/lpizzinidev)
### [`v6.8.0`](https://togithub.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#680--2022-12-05)
[Compare Source](https://togithub.com/Automattic/mongoose/compare/6.7.5...6.8.0)
\==================
- feat: add alpha support for Deno [#12397](https://togithub.com/Automattic/mongoose/issues/12397) [#9056](https://togithub.com/Automattic/mongoose/issues/9056)
- feat: add deprecation warning for default strictQuery [#12666](https://togithub.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://togithub.com/Automattic/mongoose/issues/12564) [#12651](https://togithub.com/Automattic/mongoose/issues/12651) [IslandRhythms](https://togithub.com/IslandRhythms)
- feat(document): add $clone method [#12549](https://togithub.com/Automattic/mongoose/issues/12549) [#11849](https://togithub.com/Automattic/mongoose/issues/11849) [lpizzinidev](https://togithub.com/lpizzinidev)
- feat(populate): allow overriding `localField` and `foreignField` for virtual populate [#12657](https://togithub.com/Automattic/mongoose/issues/12657) [#6963](https://togithub.com/Automattic/mongoose/issues/6963) [IslandRhythms](https://togithub.com/IslandRhythms)
- feat(schema+types): add { errorHandler: true } option to Schema post() for better TypeScript support [#12723](https://togithub.com/Automattic/mongoose/issues/12723) [#12583](https://togithub.com/Automattic/mongoose/issues/12583)
- feat(debug): allow setting debug on a per-connection basis [#12704](https://togithub.com/Automattic/mongoose/issues/12704) [#12700](https://togithub.com/Automattic/mongoose/issues/12700) [lpizzinidev](https://togithub.com/lpizzinidev)
- feat: add rewind function to QueryCursor [#12710](https://togithub.com/Automattic/mongoose/issues/12710) [passabilities](https://togithub.com/passabilities)
- feat(types): infer timestamps option from schema [#12731](https://togithub.com/Automattic/mongoose/issues/12731) [#12069](https://togithub.com/Automattic/mongoose/issues/12069)
- docs: change links to not link to api.html anymore [#12644](https://togithub.com/Automattic/mongoose/issues/12644) [hasezoey](https://togithub.com/hasezoey)
### [`v6.7.5`](https://togithub.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#675--2022-11-30)
[Compare Source](https://togithub.com/Automattic/mongoose/compare/6.7.4...6.7.5)
\==================
- fix(schema): copy indexes when calling add() with schema instance [#12737](https://togithub.com/Automattic/mongoose/issues/12737) [#12654](https://togithub.com/Automattic/mongoose/issues/12654)
- fix(query): handle deselecting \_id when another field has schema-level select: false [#12736](https://togithub.com/Automattic/mongoose/issues/12736) [#12670](https://togithub.com/Automattic/mongoose/issues/12670)
- fix(types): support using UpdateQuery in bulkWrite() [#12742](https://togithub.com/Automattic/mongoose/issues/12742) [#12595](https://togithub.com/Automattic/mongoose/issues/12595)
- docs(middleware): added note about execution policy on subdocuments [#12735](https://togithub.com/Automattic/mongoose/issues/12735) [#12694](https://togithub.com/Automattic/mongoose/issues/12694) [lpizzinidev](https://togithub.com/lpizzinidev)
- docs(validation): clarify context for update validators in validation docs [#12738](https://togithub.com/Automattic/mongoose/issues/12738) [#12655](https://togithub.com/Automattic/mongoose/issues/12655) [IslandRhythms](https://togithub.com/IslandRhythms)
### [`v6.7.4`](https://togithub.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#674--2022-11-28)
[Compare Source](https://togithub.com/Automattic/mongoose/compare/6.7.3...6.7.4)
\==================
- fix: allow setting global strictQuery after Schema creation [#12717](https://togithub.com/Automattic/mongoose/issues/12717) [#12703](https://togithub.com/Automattic/mongoose/issues/12703) [lpizzinidev](https://togithub.com/lpizzinidev)
- fix(cursor): make eachAsync() avoid modifying batch when mixing parallel and batchSize [#12716](https://togithub.com/Automattic/mongoose/issues/12716)
- fix(types): infer virtuals in query results [#12727](https://togithub.com/Automattic/mongoose/issues/12727) [#12702](https://togithub.com/Automattic/mongoose/issues/12702) [#12684](https://togithub.com/Automattic/mongoose/issues/12684)
- fix(types): correctly infer ReadonlyArray types in schema definitions [#12720](https://togithub.com/Automattic/mongoose/issues/12720)
- fix(types): avoid typeof Query with generics for TypeScript 4.6 support [#12712](https://togithub.com/Automattic/mongoose/issues/12712) [#12688](https://togithub.com/Automattic/mongoose/issues/12688)
- chore: avoid bundling .tgz files when publishing [#12725](https://togithub.com/Automattic/mongoose/issues/12725) [hasezoey](https://togithub.com/hasezoey)
### [`v6.7.3`](https://togithub.com/Automattic/mongoose/compare/f1c433c0f90ad1a65c8b3795eefaaf02a64b849e...e50de5c0f7f2e3d9386638f7b5aac027cdd153e1)
[Compare Source](https://togithub.com/Automattic/mongoose/compare/6.7.2...6.7.3)
### [`v6.7.2`](https://togithub.com/Automattic/mongoose/compare/f90e73d89344257c365134d58ace0a5f81eb89d4...f1c433c0f90ad1a65c8b3795eefaaf02a64b849e)
[Compare Source](https://togithub.com/Automattic/mongoose/compare/6.7.1...6.7.2)
### [`v6.7.1`](https://togithub.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#671--2022-11-02)
[Compare Source](https://togithub.com/Automattic/mongoose/compare/6.7.0...6.7.1)
\==================
- fix(query): select Map field with select: false when explicitly requested [#12616](https://togithub.com/Automattic/mongoose/issues/12616) [#12603](https://togithub.com/Automattic/mongoose/issues/12603) [lpizzinidev](https://togithub.com/lpizzinidev)
- fix: correctly find paths underneath single nested document with an array of mixed [#12605](https://togithub.com/Automattic/mongoose/issues/12605) [#12530](https://togithub.com/Automattic/mongoose/issues/12530)
- fix(populate): better support for populating maps of arrays of refs [#12601](https://togithub.com/Automattic/mongoose/issues/12601) [#12494](https://togithub.com/Automattic/mongoose/issues/12494)
- fix(types): add missing create constructor signature override type [#12585](https://togithub.com/Automattic/mongoose/issues/12585) [naorpeled](https://togithub.com/naorpeled)
- fix(types): make array paths optional in inferred type of array default returns undefined [#12649](https://togithub.com/Automattic/mongoose/issues/12649) [#12420](https://togithub.com/Automattic/mongoose/issues/12420)
- fix(types): improve ValidateOpts type [#12606](https://togithub.com/Automattic/mongoose/issues/12606) [Freezystem](https://togithub.com/Freezystem)
- docs: add Lodash guide highlighting issues with cloneDeep() [#12609](https://togithub.com/Automattic/mongoose/issues/12609)
- docs: removed v5 link from v6 docs [#12641](https://togithub.com/Automattic/mongoose/issues/12641) [#12624](https://togithub.com/Automattic/mongoose/issues/12624) [lpizzinidev](https://togithub.com/lpizzinidev)
- docs: removed outdated connection example [#12618](https://togithub.com/Automattic/mongoose/issues/12618) [lpizzinidev](https://togithub.com/lpizzinidev)
### [`v6.7.0`](https://togithub.com/Automattic/mongoose/compare/6.6.7...6.7.0)
[Compare Source](https://togithub.com/Automattic/mongoose/compare/6.6.7...6.7.0)
### [`v6.6.7`](https://togithub.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#667--2022-10-21)
[Compare Source](https://togithub.com/Automattic/mongoose/compare/6.6.6...6.6.7)
\==================
- fix: correct browser build and improve isAsyncFunction check for browser [#12577](https://togithub.com/Automattic/mongoose/issues/12577) [#12576](https://togithub.com/Automattic/mongoose/issues/12576) [#12392](https://togithub.com/Automattic/mongoose/issues/12392)
- fix(query): allow overwriting discriminator key with overwriteDiscriminatorKey if strict: 'throw' [#12578](https://togithub.com/Automattic/mongoose/issues/12578) [#12513](https://togithub.com/Automattic/mongoose/issues/12513)
### [`v6.6.6`](https://togithub.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#666--2022-10-20)
[Compare Source](https://togithub.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://togithub.com/Automattic/mongoose/issues/12571) [#12518](https://togithub.com/Automattic/mongoose/issues/12518)
- fix(document): allow creating document with document array and top-level key named schema [#12569](https://togithub.com/Automattic/mongoose/issues/12569) [#12480](https://togithub.com/Automattic/mongoose/issues/12480)
- fix(cast): make schema-level strictQuery override schema-level strict for query filters [#12570](https://togithub.com/Automattic/mongoose/issues/12570) [#12508](https://togithub.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://togithub.com/Automattic/mongoose/issues/12568) [#12478](https://togithub.com/Automattic/mongoose/issues/12478)
- fix: Throws error when updating a key name that match the discriminator key name on nested object [#12534](https://togithub.com/Automattic/mongoose/issues/12534) [#12517](https://togithub.com/Automattic/mongoose/issues/12517) [lpizzinidev](https://togithub.com/lpizzinidev)
- fix(types): add limit to $filter expression [#12553](https://togithub.com/Automattic/mongoose/issues/12553) [raphael-papazikas](https://togithub.com/raphael-papazikas)
- fix(types): correct replaceWith type pipeline stage [#12535](https://togithub.com/Automattic/mongoose/issues/12535) [FabioCingottini](https://togithub.com/FabioCingottini)
- fix(types): add missing densify type pipeline type [#12533](https://togithub.com/Automattic/mongoose/issues/12533) [FabioCingottini](https://togithub.com/FabioCingottini)
- docs(populate): added transform option description [#12560](https://togithub.com/Automattic/mongoose/issues/12560) [#12551](https://togithub.com/Automattic/mongoose/issues/12551) [lpizzinidev](https://togithub.com/lpizzinidev)
- docs(connection): add sample to useDb() documentation [#12541](https://togithub.com/Automattic/mongoose/issues/12541) [lpizzinidev](https://togithub.com/lpizzinidev)
- docs(guide): update broken read-preference links [#12538](https://togithub.com/Automattic/mongoose/issues/12538) [#12525](https://togithub.com/Automattic/mongoose/issues/12525) [hasezoey](https://togithub.com/hasezoey)
- chore: add TypeScript version field to issue template [#12532](https://togithub.com/Automattic/mongoose/issues/12532) [hasezoey](https://togithub.com/hasezoey)
### [`v6.6.5`](https://togithub.com/Automattic/mongoose/compare/df01ba6bdff9cae17697b72b0178492237a776bc...8846d2918184c1598118a2681375af8cee61604c)
[Compare Source](https://togithub.com/Automattic/mongoose/compare/6.6.4...6.6.5)
### [`v6.6.4`](https://togithub.com/Automattic/mongoose/compare/6.6.3...6.6.4)
[Compare Source](https://togithub.com/Automattic/mongoose/compare/6.6.3...6.6.4)
### [`v6.6.3`](https://togithub.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#663--2022-09-30)
[Compare Source](https://togithub.com/Automattic/mongoose/compare/6.6.2...6.6.3)
\==================
- fix(query): treat findOne(\_id) as equivalent to findOne({ \_id }) [#12485](https://togithub.com/Automattic/mongoose/issues/12485) [#12325](https://togithub.com/Automattic/mongoose/issues/12325)
- fix(timestamps): findOneAndUpdate creates subdocs with timestamps in reverse order [#12484](https://togithub.com/Automattic/mongoose/issues/12484) [#12475](https://togithub.com/Automattic/mongoose/issues/12475) [lpizzinidev](https://togithub.com/lpizzinidev)
- fix(types): make schema.plugin() more flexible for schemas that don't define any generics [#12486](https://togithub.com/Automattic/mongoose/issues/12486) [#12454](https://togithub.com/Automattic/mongoose/issues/12454)
- fix(types): add "array of array key-value pairs" as a argument option for "query.sort()" [#12483](https://togithub.com/Automattic/mongoose/issues/12483) [#12434](https://togithub.com/Automattic/mongoose/issues/12434) [hasezoey](https://togithub.com/hasezoey)
- fix(types): remove unused defaults in "PluginFunction" [#12459](https://togithub.com/Automattic/mongoose/issues/12459) [hasezoey](https://togithub.com/hasezoey)
- fix(types): update DiscriminatorSchema to have better names and combine statics [#12460](https://togithub.com/Automattic/mongoose/issues/12460) [hasezoey](https://togithub.com/hasezoey)
### [`v6.6.2`](https://togithub.com/Automattic/mongoose/compare/71478c4ff64a8afa6007c9d246e4403f701ed48a...17785a580b910599cfef4a453c6d29aa482e602c)
[Compare Source](https://togithub.com/Automattic/mongoose/compare/6.6.1...6.6.2)
### [`v6.6.1`](https://togithub.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#661--2022-09-14)
[Compare Source](https://togithub.com/Automattic/mongoose/compare/6.6.0...6.6.1)
\==================
- fix: correctly apply defaults after subdoc init [#12328](https://togithub.com/Automattic/mongoose/issues/12328)
- fix(array): avoid using default \_id when using pull() [#12294](https://togithub.com/Automattic/mongoose/issues/12294)
- fix: allow null values inside $expr objects [#12429](https://togithub.com/Automattic/mongoose/issues/12429) [MartinDrost](https://togithub.com/MartinDrost)
- fix(query): use correct Query constructor when cloning query [#12418](https://togithub.com/Automattic/mongoose/issues/12418)
- docs(website): remove setting "latest38x" which is not used anywhere [#12396](https://togithub.com/Automattic/mongoose/issues/12396) [hasezoey](https://togithub.com/hasezoey)
### [`v6.6.0`](https://togithub.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#660--2022-09-08)
[Compare Source](https://togithub.com/Automattic/mongoose/compare/6.5.5...6.6.0)
\==================
- feat: upgrade mongodb driver -> 4.9.1 [#12370](https://togithub.com/Automattic/mongoose/issues/12370) [AbdelrahmanHafez](https://togithub.com/AbdelrahmanHafez)
- feat: re-export default Mongoose instance properties for ESM named imports support [#12256](https://togithub.com/Automattic/mongoose/issues/12256)
- feat(model): add option to skip invalid fields with castObject() [#12156](https://togithub.com/Automattic/mongoose/issues/12156) [IslandRhythms](https://togithub.com/IslandRhythms)
- feat: use setPrototypeOf() instead of **proto** to allow running on Deno [#12315](https://togithub.com/Automattic/mongoose/issues/12315)
- feat(QueryCursor): add support for AbortSignal on eachAsync() [#12323](https://togithub.com/Automattic/mongoose/issues/12323)
- feat(types): add types for new $densify operator [#12118](https://togithub.com/Automattic/mongoose/issues/12118) [IslandRhythms](https://togithub.com/IslandRhythms)
### [`v6.5.5`](https://togithub.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#655--2022-09-07)
[Compare Source](https://togithub.com/Automattic/mongoose/compare/6.5.4...6.5.5)
\==================
- fix(setDefaultsOnInsert): avoid applying defaults on insert if nested property set [#12279](https://togithub.com/Automattic/mongoose/issues/12279)
- fix(model): make applyHooks() and applyMethods() handle case where custom method is set to Mongoose implementation [#12254](https://togithub.com/Automattic/mongoose/issues/12254)
- fix(types): add string "ascending" and "descending" index-directions [#10269](https://togithub.com/Automattic/mongoose/issues/10269)
- docs: upgrade dox to 1.0.0 [#12403](https://togithub.com/Automattic/mongoose/issues/12403) [hasezoey](https://togithub.com/hasezoey)
- docs: update old mongodb nodejs driver documentation urls [#12387](https://togithub.com/Automattic/mongoose/issues/12387) [hasezoey](https://togithub.com/hasezoey)
- docs: update JSDOC ... (spread) definition [#12388](https://togithub.com/Automattic/mongoose/issues/12388) [hasezoey](https://togithub.com/hasezoey)
- refactor(model): allow optionally passing indexes to createIndexes and cleanIndexes [#12280](https://togithub.com/Automattic/mongoose/issues/12280) [AbdelrahmanHafez](https://togithub.com/AbdelrahmanHafez)
### [`v6.5.4`](https://togithub.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#654--2022-08-30)
[Compare Source](https://togithub.com/Automattic/mongoose/compare/6.5.3...6.5.4)
\==================
- fix(document): allow calling $assertPopulated() with values to better support manual population [#12233](https://togithub.com/Automattic/mongoose/issues/12233)
- fix(connection+mongoose): better handling for calling model() with 1 argument [#12359](https://togithub.com/Automattic/mongoose/issues/12359)
- fix(model): allow defining discriminator virtuals and methods using schema options [#12326](https://togithub.com/Automattic/mongoose/issues/12326)
- fix(types): fix MongooseQueryMiddleware missing "findOneAndReplace" and "replaceOne" [#12330](https://togithub.com/Automattic/mongoose/issues/12330) [#12329](https://togithub.com/Automattic/mongoose/issues/12329) [Jule-](https://togithub.com/Jule-) [lpizzinidev](https://togithub.com/lpizzinidev)
- fix(types): fix replaceOne return type [#12351](https://togithub.com/Automattic/mongoose/issues/12351) [lpizzinidev](https://togithub.com/lpizzinidev)
- fix(types): use this for return type from $assertPopulated() [#12234](https://togithub.com/Automattic/mongoose/issues/12234)
- docs: highlight how to connect using auth in README [#12354](https://togithub.com/Automattic/mongoose/issues/12354) [AntonyOnScript](https://togithub.com/AntonyOnScript)
- docs: improve jsdoc comments for private methods [#12337](https://togithub.com/Automattic/mongoose/issues/12337) [hasezoey](https://togithub.com/hasezoey)
- docs: fix minor typo in compatibility table header [#12355](https://togithub.com/Automattic/mongoose/issues/12355) [skyme5](https://togithub.com/skyme5)
### [`v6.5.3`](https://togithub.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#653--2022-08-24)
[Compare Source](https://togithub.com/Automattic/mongoose/compare/6.5.2...6.5.3)
\==================
- fix(document): handle maps when applying defaults to nested paths [#12322](https://togithub.com/Automattic/mongoose/issues/12322)
- fix(schema): make ArraySubdocuments apply \_id defaults on init [#12264](https://togithub.com/Automattic/mongoose/issues/12264)
- fix(populate): handle specifying recursive populate as a string with discriminators [#12266](https://togithub.com/Automattic/mongoose/issues/12266)
- perf(types): remove extends Query in Schema.pre() and Schema.post(), loosen `discriminator()` generic [#10349](https://togithub.com/Automattic/mongoose/issues/10349)
- perf(types): some more micro-optimizations re: [#10349](https://togithub.com/Automattic/mongoose/issues/10349), remove extra type checking on $ne, etc.
- fix(types): infer schema on `connection.model()` [#12298](https://togithub.com/Automattic/mongoose/issues/12298) [#12125](https://togithub.com/Automattic/mongoose/issues/12125) [hasezoey](https://togithub.com/hasezoey)
- fix(types): add missing `findById()` type definitions [#12309](https://togithub.com/Automattic/mongoose/issues/12309) [lpizzinidev](https://togithub.com/lpizzinidev)
- fix(types): allow $search in $lookup pipeline stages for MongoDB v6.x support [#12278](https://togithub.com/Automattic/mongoose/issues/12278) [AbdelrahmanHafez](https://togithub.com/AbdelrahmanHafez)
- fix(types): add parameter "options" to "Model.remove" [#12258](https://togithub.com/Automattic/mongoose/issues/12258) [hasezoey](https://togithub.com/hasezoey)
- fix(types): sync single-generic-no-constraint "model" between "index.d.ts" and "connection.d.ts" [#12299](https://togithub.com/Automattic/mongoose/issues/12299) [hasezoey](https://togithub.com/hasezoey)
- fix(types): update isDirectModified typing [#12290](https://togithub.com/Automattic/mongoose/issues/12290) [gabrielDonnantuoni](https://togithub.com/gabrielDonnantuoni)
- docs: update links on api docs [#12293](https://togithub.com/Automattic/mongoose/issues/12293) [eatmoarrice](https://togithub.com/eatmoarrice)
- docs: add note about language_override option [#12310](https://togithub.com/Automattic/mongoose/issues/12310) [IslandRhythms](https://togithub.com/IslandRhythms)
- docs(document): add "String\[]" to Document.depopulate as jsdoc parameter type [#12300](https://togithub.com/Automattic/mongoose/issues/12300) [hasezoey](https://togithub.com/hasezoey)
- docs: update Node.js EventEmitter url [#12303](https://togithub.com/Automattic/mongoose/issues/12303) [rainrisa](https://togithub.com/rainrisa)
### [`v6.5.2`](https://togithub.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#652--2022-08-09)
[Compare Source](https://togithub.com/Automattic/mongoose/compare/6.5.1...6.5.2)
\==================
- fix(aggregate): avoid throwing error when disconnecting with change stream open [#12201](https://togithub.com/Automattic/mongoose/issues/12201) [ramos-ph](https://togithub.com/ramos-ph)
- fix(query): overwrite top-level key if using Query.prototype.set() to set to undefined [#12155](https://togithub.com/Automattic/mongoose/issues/12155)
- fix(query): shallow clone options before modifying [#12176](https://togithub.com/Automattic/mongoose/issues/12176)
- fix(types): auto schema type inference on `Connection.prototype.model()` [#12240](https://togithub.com/Automattic/mongoose/issues/12240) [hasezoey](https://togithub.com/hasezoey)
- fix(types): better typescript support for schema plugins [#12139](https://togithub.com/Automattic/mongoose/issues/12139) [emiljanitzek](https://togithub.com/emiljanitzek)
- fix(types): make bulkWrite() type param optional [#12221](https://togithub.com/Automattic/mongoose/issues/12221) [#12212](https://togithub.com/Automattic/mongoose/issues/12212)
- docs: misc cleanup [#12199](https://togithub.com/Automattic/mongoose/issues/12199) [hasezoey](https://togithub.com/hasezoey)
- docs: highlight current top-most visible header in navbar [#12222](https://togithub.com/Automattic/mongoose/issues/12222) [hasezoey](https://togithub.com/hasezoey)
- docs(populate): improve examples for Document.prototype.populate() [#12111](https://togithub.com/Automattic/mongoose/issues/12111)
- docs(middleware): clarify document vs model in middleware docs [#12113](https://togithub.com/Automattic/mongoose/issues/12113)
### [`v6.5.1`](https://togithub.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#651--2022-08-03)
[Compare Source](https://togithub.com/Automattic/mongoose/compare/6.5.0...6.5.1)
\==================
- fix(timestamps): set timestamps on child schema when child schema has timestamps: true but parent schema does not [#12119](https://togithub.com/Automattic/mongoose/issues/12119)
- fix(schema+timestamps): handle insertMany() with timestamps and discriminators [#12150](https://togithub.com/Automattic/mongoose/issues/12150)
- fix(model+query): handle populate with lean transform that deletes \_id [#12143](https://togithub.com/Automattic/mongoose/issues/12143)
- fix(types): allow $pull with \_id [#12142](https://togithub.com/Automattic/mongoose/issues/12142)
- fix(types): add schema plugin option inference [#12196](https://togithub.com/Automattic/mongoose/issues/12196) [hasezoey](https://togithub.com/hasezoey)
- fix(types): pass type to mongodb bulk write operation [#12167](https://togithub.com/Automattic/mongoose/issues/12167) [emiljanitzek](https://togithub.com/emiljanitzek)
- fix(types): map correct generics from model to schema [#12125](https://togithub.com/Automattic/mongoose/issues/12125) [emiljanitzek](https://togithub.com/emiljanitzek)
- fix(types): avoid baffling circular reference when using PopulatedDoc with a bidirectional reference [#12136](https://togithub.com/Automattic/mongoose/issues/12136)
- fix(types): allow using path with $count [#12149](https://togithub.com/Automattic/mongoose/issues/12149)
- docs(compatibility): change to use a table [#12200](https://togithub.com/Automattic/mongoose/issues/12200) [hasezoey](https://togithub.com/hasezoey)
- docs(api_split.pug): add "code" to sidebar entries [#12153](https://togithub.com/Automattic/mongoose/issues/12153) [hasezoey](https://togithub.com/hasezoey)
- docs: add "code" to Headers (and index list) [#12152](https://togithub.com/Automattic/mongoose/issues/12152) [hasezoey](https://togithub.com/hasezoey)
### [`v6.5.0`](https://togithub.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#650--2022-07-26)
[Compare Source](https://togithub.com/Automattic/mongoose/compare/6.4.7...6.5.0)
\==================
- perf(document): avoid creating unnecessary empty objects when creating a state machine [#11988](https://togithub.com/Automattic/mongoose/issues/11988)
- feat: upgrade mongodb driver -> 4.8.1 [#12103](https://togithub.com/Automattic/mongoose/issues/12103) [AbdelrahmanHafez](https://togithub.com/AbdelrahmanHafez)
- feat(model): allow passing timestamps option to Model.bulkSave(...) [#12082](https://togithub.com/Automattic/mongoose/issues/12082) [AbdelrahmanHafez](https://togithub.com/AbdelrahmanHafez)
- feat(model): add castObject() function that casts a POJO to the model's schema [#11945](https://togithub.com/Automattic/mongoose/issues/11945)
- feat(document): add $inc() helper that increments numeric paths [#12115](https://togithub.com/Automattic/mongoose/issues/12115)
- feat(schema): add schema level lean option [IslandRhythms](https://togithub.com/IslandRhythms)
- feat(schema): add global id option to disable id on schemas [#12067](https://togithub.com/Automattic/mongoose/issues/12067) [IslandRhythms](https://togithub.com/IslandRhythms)
- fix(connection): re-run Model.init() if re-connecting after explicitly closing a connection [#12130](https://togithub.com/Automattic/mongoose/issues/12130)
- feat(model): add applyDefaults() helper that allows applying defaults to document or POJO [#11945](https://togithub.com/Automattic/mongoose/issues/11945)
- feat(model): allow calling hydrate() with { setters: true } [#11653](https://togithub.com/Automattic/mongoose/issues/11653)
- feat(model): add hydrate option to Model.watch() to automatically hydrate fullDocument [#12121](https://togithub.com/Automattic/mongoose/issues/12121)
- feat(types): add support for automatically typed virtuals in schemas [#11908](https://togithub.com/Automattic/mongoose/issues/11908) [mohammad0-0ahmad](https://togithub.com/mohammad0-0ahmad)
### [`v6.4.7`](https://togithub.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#647--2022-07-25)
[Compare Source](https://togithub.com/Automattic/mongoose/compare/6.4.6...6.4.7)
\==================
- fix(virtualtype): use $locals for default virtual getter/setter rather than top-level doc [#12124](https://togithub.com/Automattic/mongoose/issues/12124)
- fix(document): call subdocument getters if child schema has getters: true [#12105](https://togithub.com/Automattic/mongoose/issues/12105)
- fix(schematype): actually always return "this" where specified [#12141](https://togithub.com/Automattic/mongoose/issues/12141) [hasezoey](https://togithub.com/hasezoey)
- fix(types): correct return value for Model.exists() [#12094](https://togithub.com/Automattic/mongoose/issues/12094)
- docs(guides): add link to advanced schemas doc [#12073](https://togithub.com/Automattic/mongoose/issues/12073)
- docs: handle [@see](https://togithub.com/see) in jsdoc [#12144](https://togithub.com/Automattic/mongoose/issues/12144) [hasezoey](https://togithub.com/hasezoey)
- docs: make use of the deprecated tag available in jsdoc for documentation [#12080](https://togithub.com/Automattic/mongoose/issues/12080) [hasezoey](https://togithub.com/hasezoey)
- docs(api_split): add basic DEPRECATED output [#12146](https://togithub.com/Automattic/mongoose/issues/12146) [hasezoey](https://togithub.com/hasezoey)
- docs: various jsdoc cleanup [#12140](https://togithub.com/Automattic/mongoose/issues/12140) [hasezoey](https://togithub.com/hasezoey)
- docs(api_split.pug): add "code" to parameter name [#12145](https://togithub.com/Automattic/mongoose/issues/12145) [hasezoey](https://togithub.com/hasezoey)
### [`v6.4.6`](https://togithub.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#646--2022-07-20)
[Compare Source](https://togithub.com/Automattic/mongoose/compare/6.4.5...6.4.6)
\==================
- fix(schema): disallow setting **proto** when creating schema with dotted properties [#12085](https://togithub.com/Automattic/mongoose/issues/12085)
- fix(document): avoid mutating original object passed to $set() when applying defaults to nested properties [#12102](https://togithub.com/Automattic/mongoose/issues/12102)
- fix(query): apply lean transform option to top-level document [#12093](https://togithub.com/Automattic/mongoose/issues/12093)
- docs(migrating_to\_6): correct example for `isObjectIdOrHexString()` [#12123](https://togithub.com/Automattic/mongoose/issues/12123) [LokeshKanumoori](https://togithub.com/LokeshKanumoori)
### [`v6.4.5`](https://togithub.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#645--2022-07-18)
[Compare Source](https://togithub.com
Configuration
📅 Schedule: Branch creation - "" (UTC), 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.2.8
->6.11.3
GitHub Vulnerability Alerts
CVE-2022-2564
Mongoose is a MongoDB object modeling tool designed to work in an asynchronous environment. Affected versions of this package are vulnerable to Prototype Pollution. The
Schema.path()
function is vulnerable to prototype pollution when setting the schema object. This vulnerability allows modification of the Object prototype and could be manipulated into a Denial of Service (DoS) attack.CVE-2023-3696
Prototype Pollution in GitHub repository automattic/mongoose prior to 7.3.3, 6.11.3, and 5.13.20.
CVE-2022-24304
Description
Mongoose is a MongoDB object modeling tool designed to work in an asynchronous environment.
Affected versions of this package are vulnerable to Prototype Pollution. The
Schema.path()
function is vulnerable to prototype pollution when setting theschema
object. This vulnerability allows modification of the Object prototype and could be manipulated into a Denial of Service (DoS) attack.Proof of Concept
Impact
This vulnerability can be manipulated to exploit other types of attacks, such as Denial of service (DoS), Remote Code Execution, or Property Injection.
Release Notes
Automattic/mongoose (mongoose)
### [`v6.11.3`](https://togithub.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#6113--2023-07-11) [Compare Source](https://togithub.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://togithub.com/Automattic/mongoose/issues/13317) [#13595](https://togithub.com/Automattic/mongoose/issues/13595) ### [`v6.11.2`](https://togithub.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#6112--2023-06-08) [Compare Source](https://togithub.com/Automattic/mongoose/compare/6.11.1...6.11.2) \=================== - fix(cursor): allow find middleware to modify query cursor options [#13476](https://togithub.com/Automattic/mongoose/issues/13476) [#13453](https://togithub.com/Automattic/mongoose/issues/13453) [#13435](https://togithub.com/Automattic/mongoose/issues/13435) ### [`v6.11.1`](https://togithub.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#6111--2023-05-08) [Compare Source](https://togithub.com/Automattic/mongoose/compare/6.11.0...6.11.1) \=================== - fix(query): apply schema-level paths before calculating projection for findOneAndUpdate() [#13348](https://togithub.com/Automattic/mongoose/issues/13348) [#13340](https://togithub.com/Automattic/mongoose/issues/13340) - fix: add SUPPRESS_JEST_WARNINGS environment variable to hide jest warnings [#13384](https://togithub.com/Automattic/mongoose/issues/13384) [#13373](https://togithub.com/Automattic/mongoose/issues/13373) - types(model): allow overwriting expected param type for bulkWrite() [#13292](https://togithub.com/Automattic/mongoose/issues/13292) [hasezoey](https://togithub.com/hasezoey) ### [`v6.11.0`](https://togithub.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#6110--2023-05-01) [Compare Source](https://togithub.com/Automattic/mongoose/compare/6.10.5...6.11.0) \=================== - feat: upgrade to mongodb 4.16.0 for Deno+Atlas connection fix [#13337](https://togithub.com/Automattic/mongoose/issues/13337) [#13075](https://togithub.com/Automattic/mongoose/issues/13075) - perf: speed up creating maps of subdocuments [#13280](https://togithub.com/Automattic/mongoose/issues/13280) [#13191](https://togithub.com/Automattic/mongoose/issues/13191) [#13271](https://togithub.com/Automattic/mongoose/issues/13271) - fix(query): set ObjectParameterError if calling findOneAndX() with filter as non-object [#13338](https://togithub.com/Automattic/mongoose/issues/13338) - fix(document): merge Document $inc calls instead of overwriting [#13322](https://togithub.com/Automattic/mongoose/issues/13322) - fix(update): handle casting doubly nested arrays with $pullAll [#13285](https://togithub.com/Automattic/mongoose/issues/13285) - docs: backport documentation versioning changes to 6.x [#13253](https://togithub.com/Automattic/mongoose/issues/13253) [#13190](https://togithub.com/Automattic/mongoose/issues/13190) [hasezoey](https://togithub.com/hasezoey) ### [`v6.10.5`](https://togithub.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#6105--2023-04-06) [Compare Source](https://togithub.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://togithub.com/Automattic/mongoose/issues/12953) - fix(model): execute valid write operations if calling bulkWrite() with ordered: false [#13218](https://togithub.com/Automattic/mongoose/issues/13218) [#13176](https://togithub.com/Automattic/mongoose/issues/13176) - fix(array): pass-through all parameters [#13202](https://togithub.com/Automattic/mongoose/issues/13202) [#13201](https://togithub.com/Automattic/mongoose/issues/13201) [hasezoey](https://togithub.com/hasezoey) - fix: improve error message when sorting by empty string [#13249](https://togithub.com/Automattic/mongoose/issues/13249) [#10182](https://togithub.com/Automattic/mongoose/issues/10182) - docs: add version support and check version docs [#13251](https://togithub.com/Automattic/mongoose/issues/13251) [#13193](https://togithub.com/Automattic/mongoose/issues/13193) ### [`v6.10.4`](https://togithub.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#6104--2023-03-21) [Compare Source](https://togithub.com/Automattic/mongoose/compare/6.10.3...6.10.4) \=================== - fix(document): apply setters on resulting value when calling Document.prototype.$inc() [#13178](https://togithub.com/Automattic/mongoose/issues/13178) [#13158](https://togithub.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://togithub.com/Automattic/mongoose/issues/13163) [#12791](https://togithub.com/Automattic/mongoose/issues/12791) - docs(guide+schematypes): add UUID to schematypes guide [#13184](https://togithub.com/Automattic/mongoose/issues/13184) ### [`v6.10.3`](https://togithub.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#6103--2023-03-13) [Compare Source](https://togithub.com/Automattic/mongoose/compare/6.10.2...6.10.3) \=================== - fix(connection): add stub implementation of doClose to base connection class [#13157](https://togithub.com/Automattic/mongoose/issues/13157) - fix(types): add cursor.eachAsync index parameter [#13162](https://togithub.com/Automattic/mongoose/issues/13162) [#13153](https://togithub.com/Automattic/mongoose/issues/13153) [hasezoey](https://togithub.com/hasezoey) - docs: fix 6.x docs sidebar links [#13147](https://togithub.com/Automattic/mongoose/issues/13147) [#13144](https://togithub.com/Automattic/mongoose/issues/13144) [hasezoey](https://togithub.com/hasezoey) - docs(validation): clarify that validation runs as first pre(save) middleware [#13062](https://togithub.com/Automattic/mongoose/issues/13062) ### [`v6.10.2`](https://togithub.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#6102--2023-03-07) [Compare Source](https://togithub.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://togithub.com/Automattic/mongoose/issues/13135) [#13043](https://togithub.com/Automattic/mongoose/issues/13043) [#13003](https://togithub.com/Automattic/mongoose/issues/13003) - fix(documentarray): set correct document array path if making map of document arrays [#13133](https://togithub.com/Automattic/mongoose/issues/13133) - fix: undo accidental change to `engines` in `package.json` [#13124](https://togithub.com/Automattic/mongoose/issues/13124) [lorand-horvath](https://togithub.com/lorand-horvath) - docs: quick improvement to Model.init() docs [#13054](https://togithub.com/Automattic/mongoose/issues/13054) ### [`v6.10.1`](https://togithub.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#6101--2023-03-03) [Compare Source](https://togithub.com/Automattic/mongoose/compare/6.10.0...6.10.1) \=================== - fix: avoid removing empty query filters in `$and` and `$or` [#13086](https://togithub.com/Automattic/mongoose/issues/13086) [#12898](https://togithub.com/Automattic/mongoose/issues/12898) - fix(schematype): fixed validation for required UUID field [#13018](https://togithub.com/Automattic/mongoose/issues/13018) [lpizzinidev](https://togithub.com/lpizzinidev) - fix(types): add missing Paths generic param to `Model.populate()` [#13070](https://togithub.com/Automattic/mongoose/issues/13070) - docs(migrating_to\_6): added info about removal of reconnectTries and reconnectInterval options [#13083](https://togithub.com/Automattic/mongoose/issues/13083) [lpizzinidev](https://togithub.com/lpizzinidev) - docs: fix code in headers for migrating_to\_5 [#13077](https://togithub.com/Automattic/mongoose/issues/13077) [hasezoey](https://togithub.com/hasezoey) - docs: backport misc documentation changes into 6.x [#13091](https://togithub.com/Automattic/mongoose/issues/13091) [hasezoey](https://togithub.com/hasezoey) ### [`v6.10.0`](https://togithub.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#6100--2023-02-22) [Compare Source](https://togithub.com/Automattic/mongoose/compare/6.9.3...6.10.0) \=================== - feat: upgrade to mongodb driver 4.14.0 [#13036](https://togithub.com/Automattic/mongoose/issues/13036) - feat: added Schema.prototype.omit() function [#12939](https://togithub.com/Automattic/mongoose/issues/12939) [#12931](https://togithub.com/Automattic/mongoose/issues/12931) [lpizzinidev](https://togithub.com/lpizzinidev) - feat(index): added createInitialConnection option to Mongoose constructor [#13021](https://togithub.com/Automattic/mongoose/issues/13021) [#12965](https://togithub.com/Automattic/mongoose/issues/12965) [lpizzinidev](https://togithub.com/lpizzinidev) ### [`v6.9.3`](https://togithub.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#693--2023-02-22) [Compare Source](https://togithub.com/Automattic/mongoose/compare/6.9.2...6.9.3) \================== - fix(connection): delay calculating `autoCreate` and `autoIndex` until after initial connection established [#13007](https://togithub.com/Automattic/mongoose/issues/13007) [#12940](https://togithub.com/Automattic/mongoose/issues/12940) [lpizzinidev](https://togithub.com/lpizzinidev) - fix(discriminator): allows update doc with discriminatorKey [#13056](https://togithub.com/Automattic/mongoose/issues/13056) [#13055](https://togithub.com/Automattic/mongoose/issues/13055) [abarriel](https://togithub.com/abarriel) - fix(query): avoid sending unnecessary empty projection to MongoDB server [#13059](https://togithub.com/Automattic/mongoose/issues/13059) [#13050](https://togithub.com/Automattic/mongoose/issues/13050) - fix(model): avoid sending null session option with document operations [#13053](https://togithub.com/Automattic/mongoose/issues/13053) [#13052](https://togithub.com/Automattic/mongoose/issues/13052) [lpizzinidev](https://togithub.com/lpizzinidev) - fix(types): use MergeTypes for type overrides in HydratedDocument [#13066](https://togithub.com/Automattic/mongoose/issues/13066) [#13040](https://togithub.com/Automattic/mongoose/issues/13040) - docs(middleware): list validate as a potential query middleware [#13057](https://togithub.com/Automattic/mongoose/issues/13057) [#12680](https://togithub.com/Automattic/mongoose/issues/12680) - docs(getters-setters): explain that getters do not run by default on toJSON() [#13058](https://togithub.com/Automattic/mongoose/issues/13058) [#13049](https://togithub.com/Automattic/mongoose/issues/13049) - docs: refactor docs generation scripts [#13044](https://togithub.com/Automattic/mongoose/issues/13044) [hasezoey](https://togithub.com/hasezoey) ### [`v6.9.2`](https://togithub.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#692--2023-02-16) [Compare Source](https://togithub.com/Automattic/mongoose/compare/6.9.1...6.9.2) \================== - fix(model): fixed post('save') callback parameter [#13030](https://togithub.com/Automattic/mongoose/issues/13030) [#13026](https://togithub.com/Automattic/mongoose/issues/13026) [lpizzinidev](https://togithub.com/lpizzinidev) - fix(UUID): added null check to prevent error on binaryToString conversion [#13034](https://togithub.com/Automattic/mongoose/issues/13034) [#13032](https://togithub.com/Automattic/mongoose/issues/13032) [#13029](https://togithub.com/Automattic/mongoose/issues/13029) [lpizzinidev](https://togithub.com/lpizzinidev) [Freezystem](https://togithub.com/Freezystem) - fix(query): revert breaking changes introduced by [#12797](https://togithub.com/Automattic/mongoose/issues/12797) [#12999](https://togithub.com/Automattic/mongoose/issues/12999) [lpizzinidev](https://togithub.com/lpizzinidev) - fix(document): make array $shift() use $pop instead of overwriting array [#13004](https://togithub.com/Automattic/mongoose/issues/13004) - docs: update & remove old links [#13019](https://togithub.com/Automattic/mongoose/issues/13019) [hasezoey](https://togithub.com/hasezoey) - docs(middleware): describe how to access model from document middleware [#13031](https://togithub.com/Automattic/mongoose/issues/13031) [AxeOfMen](https://togithub.com/AxeOfMen) - docs: update broken & outdated links [#13001](https://togithub.com/Automattic/mongoose/issues/13001) [hasezoey](https://togithub.com/hasezoey) - chore: change deno tests to also use MMS [#12918](https://togithub.com/Automattic/mongoose/issues/12918) [hasezoey](https://togithub.com/hasezoey) ### [`v6.9.1`](https://togithub.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#691--2023-02-06) [Compare Source](https://togithub.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://togithub.com/Automattic/mongoose/issues/12994) [lpizzinidev](https://togithub.com/lpizzinidev) - fix(document): save newly set defaults underneath single nested subdocuments [#13002](https://togithub.com/Automattic/mongoose/issues/13002) [#12905](https://togithub.com/Automattic/mongoose/issues/12905) - fix(update): handle custom discriminator model name when casting update [#12947](https://togithub.com/Automattic/mongoose/issues/12947) [wassil](https://togithub.com/wassil) - fix(connection): handles unique autoincrement ID for connections [#12990](https://togithub.com/Automattic/mongoose/issues/12990) [lpizzinidev](https://togithub.com/lpizzinidev) - fix(types): fix type of options of Model.aggregate [#12933](https://togithub.com/Automattic/mongoose/issues/12933) [ghost91-](https://togithub.com/ghost91-) - fix(types): fix "near" aggregation operator input type [#12954](https://togithub.com/Automattic/mongoose/issues/12954) [Jokero](https://togithub.com/Jokero) - fix(types): add missing Top operator to AccumulatorOperator type declaration [#12952](https://togithub.com/Automattic/mongoose/issues/12952) [lpizzinidev](https://togithub.com/lpizzinidev) - docs(transactions): added example for Connection.transaction() method [#12943](https://togithub.com/Automattic/mongoose/issues/12943) [#12934](https://togithub.com/Automattic/mongoose/issues/12934) [lpizzinidev](https://togithub.com/lpizzinidev) - docs(populate): fix out of date comment referencing onModel property [#13000](https://togithub.com/Automattic/mongoose/issues/13000) - docs(transactions): fix typo in transactions.md [#12995](https://togithub.com/Automattic/mongoose/issues/12995) [Parth86](https://togithub.com/Parth86) ### [`v6.9.0`](https://togithub.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#690--2023-01-25) [Compare Source](https://togithub.com/Automattic/mongoose/compare/6.8.4...6.9.0) \================== - feat(schema): add removeVirtual(path) function to schema [#12920](https://togithub.com/Automattic/mongoose/issues/12920) [IslandRhythms](https://togithub.com/IslandRhythms) - fix(cast): remove empty `$or` conditions after strict applied [#12898](https://togithub.com/Automattic/mongoose/issues/12898) [0x0a0d](https://togithub.com/0x0a0d) - docs: fixed typo [#12946](https://togithub.com/Automattic/mongoose/issues/12946) [Gbengstar](https://togithub.com/Gbengstar) ### [`v6.8.4`](https://togithub.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#684--2023-01-17) [Compare Source](https://togithub.com/Automattic/mongoose/compare/6.8.3...6.8.4) \================== - fix(collection): handle creating model when connection disconnected with bufferCommands = false [#12889](https://togithub.com/Automattic/mongoose/issues/12889) - fix(populate): merge instead of overwrite when match is on \_id [#12891](https://togithub.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://togithub.com/Automattic/mongoose/issues/12820) [sgpinkus](https://togithub.com/sgpinkus) - fix(types): correctly infer types on document arrays [#12884](https://togithub.com/Automattic/mongoose/issues/12884) [#12882](https://togithub.com/Automattic/mongoose/issues/12882) [JavaScriptBach](https://togithub.com/JavaScriptBach) - fix(types): added omit for ArraySubdocument type in LeanType declaration [#12903](https://togithub.com/Automattic/mongoose/issues/12903) [piyushk96](https://togithub.com/piyushk96) - fix(types): add returnDocument type safety [#12906](https://togithub.com/Automattic/mongoose/issues/12906) [AbdelrahmanHafez](https://togithub.com/AbdelrahmanHafez) - docs(typescript): add notes about virtual context to Mongoose 6 migration and TypeScript virtuals docs [#12912](https://togithub.com/Automattic/mongoose/issues/12912) [#12806](https://togithub.com/Automattic/mongoose/issues/12806) - docs(schematypes): removed dead link and fixed formatting [#12897](https://togithub.com/Automattic/mongoose/issues/12897) [#12885](https://togithub.com/Automattic/mongoose/issues/12885) [lpizzinidev](https://togithub.com/lpizzinidev) - docs: fix link to lean api [#12910](https://togithub.com/Automattic/mongoose/issues/12910) [manniL](https://togithub.com/manniL) - docs: list all possible strings for schema.pre in one place [#12868](https://togithub.com/Automattic/mongoose/issues/12868) - docs: add list of known incompatible npm packages [#12892](https://togithub.com/Automattic/mongoose/issues/12892) [IslandRhythms](https://togithub.com/IslandRhythms) ### [`v6.8.3`](https://togithub.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#683--2023-01-06) [Compare Source](https://togithub.com/Automattic/mongoose/compare/6.8.2...6.8.3) \================== - perf: improve performance of assignRawDocsToIdStructure for faster populate on large docs [#12867](https://togithub.com/Automattic/mongoose/issues/12867) [Uzlopak](https://togithub.com/Uzlopak) - fix(model): ensure consistent ordering of validation errors in insertMany() with ordered: false and rawResult: true [#12866](https://togithub.com/Automattic/mongoose/issues/12866) - fix: avoid passing final callback to pre hook, because calling the callback can mess up hook execution [#12836](https://togithub.com/Automattic/mongoose/issues/12836) - fix(types): avoid inferring timestamps if methods, virtuals, or statics set [#12871](https://togithub.com/Automattic/mongoose/issues/12871) - fix(types): correctly infer string enums on const arrays [#12870](https://togithub.com/Automattic/mongoose/issues/12870) [JavaScriptBach](https://togithub.com/JavaScriptBach) - fix(types): allow virtuals to be invoked in the definition of other virtuals [#12874](https://togithub.com/Automattic/mongoose/issues/12874) [sffc](https://togithub.com/sffc) - fix(types): add type def for Aggregate#model without arguments [#12864](https://togithub.com/Automattic/mongoose/issues/12864) [hasezoey](https://togithub.com/hasezoey) - docs(discriminators): add section about changing discriminator key [#12861](https://togithub.com/Automattic/mongoose/issues/12861) - docs(typescript): explain that virtuals inferred from schema only show up on Model, not raw document type [#12860](https://togithub.com/Automattic/mongoose/issues/12860) [#12684](https://togithub.com/Automattic/mongoose/issues/12684) ### [`v6.8.2`](https://togithub.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#682--2022-12-28) [Compare Source](https://togithub.com/Automattic/mongoose/compare/6.8.1...6.8.2) \================== - fix(schema): propagate strictQuery to implicitly created schemas for embedded discriminators [#12827](https://togithub.com/Automattic/mongoose/issues/12827) [#12796](https://togithub.com/Automattic/mongoose/issues/12796) - fix(model): respect discriminators with Model.validate() [#12824](https://togithub.com/Automattic/mongoose/issues/12824) [#12621](https://togithub.com/Automattic/mongoose/issues/12621) - fix(query): fix unexpected validation error when doing findOneAndReplace() with a nullish value [#12826](https://togithub.com/Automattic/mongoose/issues/12826) [#12821](https://togithub.com/Automattic/mongoose/issues/12821) - fix(discriminator): apply built-in plugins to discriminator schema even if mergeHooks and mergePlugins are both false [#12833](https://togithub.com/Automattic/mongoose/issues/12833) [#12696](https://togithub.com/Automattic/mongoose/issues/12696) - fix(types): add option "overwriteModels" as a schema option [#12817](https://togithub.com/Automattic/mongoose/issues/12817) [#12816](https://togithub.com/Automattic/mongoose/issues/12816) [hasezoey](https://togithub.com/hasezoey) - fix(types): add property "defaultOptions" [#12818](https://togithub.com/Automattic/mongoose/issues/12818) [hasezoey](https://togithub.com/hasezoey) - docs: make search bar respect documentation version, so you can search 5.x docs [#12548](https://togithub.com/Automattic/mongoose/issues/12548) - docs(typescript): make note about recommending strict mode when using auto typed schemas [#12825](https://togithub.com/Automattic/mongoose/issues/12825) [#12420](https://togithub.com/Automattic/mongoose/issues/12420) - docs: add section on sorting to query docs [#12588](https://togithub.com/Automattic/mongoose/issues/12588) [IslandRhythms](https://togithub.com/IslandRhythms) - test(query.test): add write-concern option [#12829](https://togithub.com/Automattic/mongoose/issues/12829) [hasezoey](https://togithub.com/hasezoey) ### [`v6.8.1`](https://togithub.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#681--2022-12-19) [Compare Source](https://togithub.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://togithub.com/Automattic/mongoose/issues/12774) [orgads](https://togithub.com/orgads) - fix(map): return value from super.delete() [#12777](https://togithub.com/Automattic/mongoose/issues/12777) [danbrud](https://togithub.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://togithub.com/Automattic/mongoose/issues/12815) [#12730](https://togithub.com/Automattic/mongoose/issues/12730) - fix(update): handle embedded discriminators when casting array filters [#12802](https://togithub.com/Automattic/mongoose/issues/12802) [#12565](https://togithub.com/Automattic/mongoose/issues/12565) - fix(populate): avoid calling transform if there's no populate results and using lean [#12804](https://togithub.com/Automattic/mongoose/issues/12804) [#12739](https://togithub.com/Automattic/mongoose/issues/12739) - fix(model): prevent index creation on syncIndexes if not necessary [#12785](https://togithub.com/Automattic/mongoose/issues/12785) [#12250](https://togithub.com/Automattic/mongoose/issues/12250) [lpizzinidev](https://togithub.com/lpizzinidev) - fix(types): correctly infer this when using pre('updateOne') with { document: true, query: false } [#12778](https://togithub.com/Automattic/mongoose/issues/12778) - fix(types): make InferSchemaType: consider { required: boolean } required if it isn't explicitly false [#12784](https://togithub.com/Automattic/mongoose/issues/12784) [JavaScriptBach](https://togithub.com/JavaScriptBach) - docs: replace many occurrences of "localhost" with "127.0.0.1" [#12811](https://togithub.com/Automattic/mongoose/issues/12811) [#12741](https://togithub.com/Automattic/mongoose/issues/12741) [hasezoey](https://togithub.com/hasezoey) [SadiqOnGithub](https://togithub.com/SadiqOnGithub) - docs(mongoose): Added missing options to set [#12810](https://togithub.com/Automattic/mongoose/issues/12810) [lpizzinidev](https://togithub.com/lpizzinidev) - docs: add info on `$locals` parameters to getters/setters tutorial [#12814](https://togithub.com/Automattic/mongoose/issues/12814) [#12550](https://togithub.com/Automattic/mongoose/issues/12550) [IslandRhythms](https://togithub.com/IslandRhythms) - docs: make Document.prototype.$clone() public [#12803](https://togithub.com/Automattic/mongoose/issues/12803) - docs(query): updated explanation for slice [#12776](https://togithub.com/Automattic/mongoose/issues/12776) [#12474](https://togithub.com/Automattic/mongoose/issues/12474) [lpizzinidev](https://togithub.com/lpizzinidev) - docs(middleware): fix broken links [#12787](https://togithub.com/Automattic/mongoose/issues/12787) [lpizzinidev](https://togithub.com/lpizzinidev) - docs(queries): fixed broken links [#12790](https://togithub.com/Automattic/mongoose/issues/12790) [lpizzinidev](https://togithub.com/lpizzinidev) ### [`v6.8.0`](https://togithub.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#680--2022-12-05) [Compare Source](https://togithub.com/Automattic/mongoose/compare/6.7.5...6.8.0) \================== - feat: add alpha support for Deno [#12397](https://togithub.com/Automattic/mongoose/issues/12397) [#9056](https://togithub.com/Automattic/mongoose/issues/9056) - feat: add deprecation warning for default strictQuery [#12666](https://togithub.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://togithub.com/Automattic/mongoose/issues/12564) [#12651](https://togithub.com/Automattic/mongoose/issues/12651) [IslandRhythms](https://togithub.com/IslandRhythms) - feat(document): add $clone method [#12549](https://togithub.com/Automattic/mongoose/issues/12549) [#11849](https://togithub.com/Automattic/mongoose/issues/11849) [lpizzinidev](https://togithub.com/lpizzinidev) - feat(populate): allow overriding `localField` and `foreignField` for virtual populate [#12657](https://togithub.com/Automattic/mongoose/issues/12657) [#6963](https://togithub.com/Automattic/mongoose/issues/6963) [IslandRhythms](https://togithub.com/IslandRhythms) - feat(schema+types): add { errorHandler: true } option to Schema post() for better TypeScript support [#12723](https://togithub.com/Automattic/mongoose/issues/12723) [#12583](https://togithub.com/Automattic/mongoose/issues/12583) - feat(debug): allow setting debug on a per-connection basis [#12704](https://togithub.com/Automattic/mongoose/issues/12704) [#12700](https://togithub.com/Automattic/mongoose/issues/12700) [lpizzinidev](https://togithub.com/lpizzinidev) - feat: add rewind function to QueryCursor [#12710](https://togithub.com/Automattic/mongoose/issues/12710) [passabilities](https://togithub.com/passabilities) - feat(types): infer timestamps option from schema [#12731](https://togithub.com/Automattic/mongoose/issues/12731) [#12069](https://togithub.com/Automattic/mongoose/issues/12069) - docs: change links to not link to api.html anymore [#12644](https://togithub.com/Automattic/mongoose/issues/12644) [hasezoey](https://togithub.com/hasezoey) ### [`v6.7.5`](https://togithub.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#675--2022-11-30) [Compare Source](https://togithub.com/Automattic/mongoose/compare/6.7.4...6.7.5) \================== - fix(schema): copy indexes when calling add() with schema instance [#12737](https://togithub.com/Automattic/mongoose/issues/12737) [#12654](https://togithub.com/Automattic/mongoose/issues/12654) - fix(query): handle deselecting \_id when another field has schema-level select: false [#12736](https://togithub.com/Automattic/mongoose/issues/12736) [#12670](https://togithub.com/Automattic/mongoose/issues/12670) - fix(types): support using UpdateQuery in bulkWrite() [#12742](https://togithub.com/Automattic/mongoose/issues/12742) [#12595](https://togithub.com/Automattic/mongoose/issues/12595) - docs(middleware): added note about execution policy on subdocuments [#12735](https://togithub.com/Automattic/mongoose/issues/12735) [#12694](https://togithub.com/Automattic/mongoose/issues/12694) [lpizzinidev](https://togithub.com/lpizzinidev) - docs(validation): clarify context for update validators in validation docs [#12738](https://togithub.com/Automattic/mongoose/issues/12738) [#12655](https://togithub.com/Automattic/mongoose/issues/12655) [IslandRhythms](https://togithub.com/IslandRhythms) ### [`v6.7.4`](https://togithub.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#674--2022-11-28) [Compare Source](https://togithub.com/Automattic/mongoose/compare/6.7.3...6.7.4) \================== - fix: allow setting global strictQuery after Schema creation [#12717](https://togithub.com/Automattic/mongoose/issues/12717) [#12703](https://togithub.com/Automattic/mongoose/issues/12703) [lpizzinidev](https://togithub.com/lpizzinidev) - fix(cursor): make eachAsync() avoid modifying batch when mixing parallel and batchSize [#12716](https://togithub.com/Automattic/mongoose/issues/12716) - fix(types): infer virtuals in query results [#12727](https://togithub.com/Automattic/mongoose/issues/12727) [#12702](https://togithub.com/Automattic/mongoose/issues/12702) [#12684](https://togithub.com/Automattic/mongoose/issues/12684) - fix(types): correctly infer ReadonlyArray types in schema definitions [#12720](https://togithub.com/Automattic/mongoose/issues/12720) - fix(types): avoid typeof Query with generics for TypeScript 4.6 support [#12712](https://togithub.com/Automattic/mongoose/issues/12712) [#12688](https://togithub.com/Automattic/mongoose/issues/12688) - chore: avoid bundling .tgz files when publishing [#12725](https://togithub.com/Automattic/mongoose/issues/12725) [hasezoey](https://togithub.com/hasezoey) ### [`v6.7.3`](https://togithub.com/Automattic/mongoose/compare/f1c433c0f90ad1a65c8b3795eefaaf02a64b849e...e50de5c0f7f2e3d9386638f7b5aac027cdd153e1) [Compare Source](https://togithub.com/Automattic/mongoose/compare/6.7.2...6.7.3) ### [`v6.7.2`](https://togithub.com/Automattic/mongoose/compare/f90e73d89344257c365134d58ace0a5f81eb89d4...f1c433c0f90ad1a65c8b3795eefaaf02a64b849e) [Compare Source](https://togithub.com/Automattic/mongoose/compare/6.7.1...6.7.2) ### [`v6.7.1`](https://togithub.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#671--2022-11-02) [Compare Source](https://togithub.com/Automattic/mongoose/compare/6.7.0...6.7.1) \================== - fix(query): select Map field with select: false when explicitly requested [#12616](https://togithub.com/Automattic/mongoose/issues/12616) [#12603](https://togithub.com/Automattic/mongoose/issues/12603) [lpizzinidev](https://togithub.com/lpizzinidev) - fix: correctly find paths underneath single nested document with an array of mixed [#12605](https://togithub.com/Automattic/mongoose/issues/12605) [#12530](https://togithub.com/Automattic/mongoose/issues/12530) - fix(populate): better support for populating maps of arrays of refs [#12601](https://togithub.com/Automattic/mongoose/issues/12601) [#12494](https://togithub.com/Automattic/mongoose/issues/12494) - fix(types): add missing create constructor signature override type [#12585](https://togithub.com/Automattic/mongoose/issues/12585) [naorpeled](https://togithub.com/naorpeled) - fix(types): make array paths optional in inferred type of array default returns undefined [#12649](https://togithub.com/Automattic/mongoose/issues/12649) [#12420](https://togithub.com/Automattic/mongoose/issues/12420) - fix(types): improve ValidateOpts type [#12606](https://togithub.com/Automattic/mongoose/issues/12606) [Freezystem](https://togithub.com/Freezystem) - docs: add Lodash guide highlighting issues with cloneDeep() [#12609](https://togithub.com/Automattic/mongoose/issues/12609) - docs: removed v5 link from v6 docs [#12641](https://togithub.com/Automattic/mongoose/issues/12641) [#12624](https://togithub.com/Automattic/mongoose/issues/12624) [lpizzinidev](https://togithub.com/lpizzinidev) - docs: removed outdated connection example [#12618](https://togithub.com/Automattic/mongoose/issues/12618) [lpizzinidev](https://togithub.com/lpizzinidev) ### [`v6.7.0`](https://togithub.com/Automattic/mongoose/compare/6.6.7...6.7.0) [Compare Source](https://togithub.com/Automattic/mongoose/compare/6.6.7...6.7.0) ### [`v6.6.7`](https://togithub.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#667--2022-10-21) [Compare Source](https://togithub.com/Automattic/mongoose/compare/6.6.6...6.6.7) \================== - fix: correct browser build and improve isAsyncFunction check for browser [#12577](https://togithub.com/Automattic/mongoose/issues/12577) [#12576](https://togithub.com/Automattic/mongoose/issues/12576) [#12392](https://togithub.com/Automattic/mongoose/issues/12392) - fix(query): allow overwriting discriminator key with overwriteDiscriminatorKey if strict: 'throw' [#12578](https://togithub.com/Automattic/mongoose/issues/12578) [#12513](https://togithub.com/Automattic/mongoose/issues/12513) ### [`v6.6.6`](https://togithub.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#666--2022-10-20) [Compare Source](https://togithub.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://togithub.com/Automattic/mongoose/issues/12571) [#12518](https://togithub.com/Automattic/mongoose/issues/12518) - fix(document): allow creating document with document array and top-level key named schema [#12569](https://togithub.com/Automattic/mongoose/issues/12569) [#12480](https://togithub.com/Automattic/mongoose/issues/12480) - fix(cast): make schema-level strictQuery override schema-level strict for query filters [#12570](https://togithub.com/Automattic/mongoose/issues/12570) [#12508](https://togithub.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://togithub.com/Automattic/mongoose/issues/12568) [#12478](https://togithub.com/Automattic/mongoose/issues/12478) - fix: Throws error when updating a key name that match the discriminator key name on nested object [#12534](https://togithub.com/Automattic/mongoose/issues/12534) [#12517](https://togithub.com/Automattic/mongoose/issues/12517) [lpizzinidev](https://togithub.com/lpizzinidev) - fix(types): add limit to $filter expression [#12553](https://togithub.com/Automattic/mongoose/issues/12553) [raphael-papazikas](https://togithub.com/raphael-papazikas) - fix(types): correct replaceWith type pipeline stage [#12535](https://togithub.com/Automattic/mongoose/issues/12535) [FabioCingottini](https://togithub.com/FabioCingottini) - fix(types): add missing densify type pipeline type [#12533](https://togithub.com/Automattic/mongoose/issues/12533) [FabioCingottini](https://togithub.com/FabioCingottini) - docs(populate): added transform option description [#12560](https://togithub.com/Automattic/mongoose/issues/12560) [#12551](https://togithub.com/Automattic/mongoose/issues/12551) [lpizzinidev](https://togithub.com/lpizzinidev) - docs(connection): add sample to useDb() documentation [#12541](https://togithub.com/Automattic/mongoose/issues/12541) [lpizzinidev](https://togithub.com/lpizzinidev) - docs(guide): update broken read-preference links [#12538](https://togithub.com/Automattic/mongoose/issues/12538) [#12525](https://togithub.com/Automattic/mongoose/issues/12525) [hasezoey](https://togithub.com/hasezoey) - chore: add TypeScript version field to issue template [#12532](https://togithub.com/Automattic/mongoose/issues/12532) [hasezoey](https://togithub.com/hasezoey) ### [`v6.6.5`](https://togithub.com/Automattic/mongoose/compare/df01ba6bdff9cae17697b72b0178492237a776bc...8846d2918184c1598118a2681375af8cee61604c) [Compare Source](https://togithub.com/Automattic/mongoose/compare/6.6.4...6.6.5) ### [`v6.6.4`](https://togithub.com/Automattic/mongoose/compare/6.6.3...6.6.4) [Compare Source](https://togithub.com/Automattic/mongoose/compare/6.6.3...6.6.4) ### [`v6.6.3`](https://togithub.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#663--2022-09-30) [Compare Source](https://togithub.com/Automattic/mongoose/compare/6.6.2...6.6.3) \================== - fix(query): treat findOne(\_id) as equivalent to findOne({ \_id }) [#12485](https://togithub.com/Automattic/mongoose/issues/12485) [#12325](https://togithub.com/Automattic/mongoose/issues/12325) - fix(timestamps): findOneAndUpdate creates subdocs with timestamps in reverse order [#12484](https://togithub.com/Automattic/mongoose/issues/12484) [#12475](https://togithub.com/Automattic/mongoose/issues/12475) [lpizzinidev](https://togithub.com/lpizzinidev) - fix(types): make schema.plugin() more flexible for schemas that don't define any generics [#12486](https://togithub.com/Automattic/mongoose/issues/12486) [#12454](https://togithub.com/Automattic/mongoose/issues/12454) - fix(types): add "array of array key-value pairs" as a argument option for "query.sort()" [#12483](https://togithub.com/Automattic/mongoose/issues/12483) [#12434](https://togithub.com/Automattic/mongoose/issues/12434) [hasezoey](https://togithub.com/hasezoey) - fix(types): remove unused defaults in "PluginFunction" [#12459](https://togithub.com/Automattic/mongoose/issues/12459) [hasezoey](https://togithub.com/hasezoey) - fix(types): update DiscriminatorSchema to have better names and combine statics [#12460](https://togithub.com/Automattic/mongoose/issues/12460) [hasezoey](https://togithub.com/hasezoey) ### [`v6.6.2`](https://togithub.com/Automattic/mongoose/compare/71478c4ff64a8afa6007c9d246e4403f701ed48a...17785a580b910599cfef4a453c6d29aa482e602c) [Compare Source](https://togithub.com/Automattic/mongoose/compare/6.6.1...6.6.2) ### [`v6.6.1`](https://togithub.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#661--2022-09-14) [Compare Source](https://togithub.com/Automattic/mongoose/compare/6.6.0...6.6.1) \================== - fix: correctly apply defaults after subdoc init [#12328](https://togithub.com/Automattic/mongoose/issues/12328) - fix(array): avoid using default \_id when using pull() [#12294](https://togithub.com/Automattic/mongoose/issues/12294) - fix: allow null values inside $expr objects [#12429](https://togithub.com/Automattic/mongoose/issues/12429) [MartinDrost](https://togithub.com/MartinDrost) - fix(query): use correct Query constructor when cloning query [#12418](https://togithub.com/Automattic/mongoose/issues/12418) - docs(website): remove setting "latest38x" which is not used anywhere [#12396](https://togithub.com/Automattic/mongoose/issues/12396) [hasezoey](https://togithub.com/hasezoey) ### [`v6.6.0`](https://togithub.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#660--2022-09-08) [Compare Source](https://togithub.com/Automattic/mongoose/compare/6.5.5...6.6.0) \================== - feat: upgrade mongodb driver -> 4.9.1 [#12370](https://togithub.com/Automattic/mongoose/issues/12370) [AbdelrahmanHafez](https://togithub.com/AbdelrahmanHafez) - feat: re-export default Mongoose instance properties for ESM named imports support [#12256](https://togithub.com/Automattic/mongoose/issues/12256) - feat(model): add option to skip invalid fields with castObject() [#12156](https://togithub.com/Automattic/mongoose/issues/12156) [IslandRhythms](https://togithub.com/IslandRhythms) - feat: use setPrototypeOf() instead of **proto** to allow running on Deno [#12315](https://togithub.com/Automattic/mongoose/issues/12315) - feat(QueryCursor): add support for AbortSignal on eachAsync() [#12323](https://togithub.com/Automattic/mongoose/issues/12323) - feat(types): add types for new $densify operator [#12118](https://togithub.com/Automattic/mongoose/issues/12118) [IslandRhythms](https://togithub.com/IslandRhythms) ### [`v6.5.5`](https://togithub.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#655--2022-09-07) [Compare Source](https://togithub.com/Automattic/mongoose/compare/6.5.4...6.5.5) \================== - fix(setDefaultsOnInsert): avoid applying defaults on insert if nested property set [#12279](https://togithub.com/Automattic/mongoose/issues/12279) - fix(model): make applyHooks() and applyMethods() handle case where custom method is set to Mongoose implementation [#12254](https://togithub.com/Automattic/mongoose/issues/12254) - fix(types): add string "ascending" and "descending" index-directions [#10269](https://togithub.com/Automattic/mongoose/issues/10269) - docs: upgrade dox to 1.0.0 [#12403](https://togithub.com/Automattic/mongoose/issues/12403) [hasezoey](https://togithub.com/hasezoey) - docs: update old mongodb nodejs driver documentation urls [#12387](https://togithub.com/Automattic/mongoose/issues/12387) [hasezoey](https://togithub.com/hasezoey) - docs: update JSDOC ... (spread) definition [#12388](https://togithub.com/Automattic/mongoose/issues/12388) [hasezoey](https://togithub.com/hasezoey) - refactor(model): allow optionally passing indexes to createIndexes and cleanIndexes [#12280](https://togithub.com/Automattic/mongoose/issues/12280) [AbdelrahmanHafez](https://togithub.com/AbdelrahmanHafez) ### [`v6.5.4`](https://togithub.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#654--2022-08-30) [Compare Source](https://togithub.com/Automattic/mongoose/compare/6.5.3...6.5.4) \================== - fix(document): allow calling $assertPopulated() with values to better support manual population [#12233](https://togithub.com/Automattic/mongoose/issues/12233) - fix(connection+mongoose): better handling for calling model() with 1 argument [#12359](https://togithub.com/Automattic/mongoose/issues/12359) - fix(model): allow defining discriminator virtuals and methods using schema options [#12326](https://togithub.com/Automattic/mongoose/issues/12326) - fix(types): fix MongooseQueryMiddleware missing "findOneAndReplace" and "replaceOne" [#12330](https://togithub.com/Automattic/mongoose/issues/12330) [#12329](https://togithub.com/Automattic/mongoose/issues/12329) [Jule-](https://togithub.com/Jule-) [lpizzinidev](https://togithub.com/lpizzinidev) - fix(types): fix replaceOne return type [#12351](https://togithub.com/Automattic/mongoose/issues/12351) [lpizzinidev](https://togithub.com/lpizzinidev) - fix(types): use this for return type from $assertPopulated() [#12234](https://togithub.com/Automattic/mongoose/issues/12234) - docs: highlight how to connect using auth in README [#12354](https://togithub.com/Automattic/mongoose/issues/12354) [AntonyOnScript](https://togithub.com/AntonyOnScript) - docs: improve jsdoc comments for private methods [#12337](https://togithub.com/Automattic/mongoose/issues/12337) [hasezoey](https://togithub.com/hasezoey) - docs: fix minor typo in compatibility table header [#12355](https://togithub.com/Automattic/mongoose/issues/12355) [skyme5](https://togithub.com/skyme5) ### [`v6.5.3`](https://togithub.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#653--2022-08-24) [Compare Source](https://togithub.com/Automattic/mongoose/compare/6.5.2...6.5.3) \================== - fix(document): handle maps when applying defaults to nested paths [#12322](https://togithub.com/Automattic/mongoose/issues/12322) - fix(schema): make ArraySubdocuments apply \_id defaults on init [#12264](https://togithub.com/Automattic/mongoose/issues/12264) - fix(populate): handle specifying recursive populate as a string with discriminators [#12266](https://togithub.com/Automattic/mongoose/issues/12266) - perf(types): remove extends Query in Schema.pre() and Schema.post(), loosen `discriminator()` generic [#10349](https://togithub.com/Automattic/mongoose/issues/10349) - perf(types): some more micro-optimizations re: [#10349](https://togithub.com/Automattic/mongoose/issues/10349), remove extra type checking on $ne, etc. - fix(types): infer schema on `connection.model()` [#12298](https://togithub.com/Automattic/mongoose/issues/12298) [#12125](https://togithub.com/Automattic/mongoose/issues/12125) [hasezoey](https://togithub.com/hasezoey) - fix(types): add missing `findById()` type definitions [#12309](https://togithub.com/Automattic/mongoose/issues/12309) [lpizzinidev](https://togithub.com/lpizzinidev) - fix(types): allow $search in $lookup pipeline stages for MongoDB v6.x support [#12278](https://togithub.com/Automattic/mongoose/issues/12278) [AbdelrahmanHafez](https://togithub.com/AbdelrahmanHafez) - fix(types): add parameter "options" to "Model.remove" [#12258](https://togithub.com/Automattic/mongoose/issues/12258) [hasezoey](https://togithub.com/hasezoey) - fix(types): sync single-generic-no-constraint "model" between "index.d.ts" and "connection.d.ts" [#12299](https://togithub.com/Automattic/mongoose/issues/12299) [hasezoey](https://togithub.com/hasezoey) - fix(types): update isDirectModified typing [#12290](https://togithub.com/Automattic/mongoose/issues/12290) [gabrielDonnantuoni](https://togithub.com/gabrielDonnantuoni) - docs: update links on api docs [#12293](https://togithub.com/Automattic/mongoose/issues/12293) [eatmoarrice](https://togithub.com/eatmoarrice) - docs: add note about language_override option [#12310](https://togithub.com/Automattic/mongoose/issues/12310) [IslandRhythms](https://togithub.com/IslandRhythms) - docs(document): add "String\[]" to Document.depopulate as jsdoc parameter type [#12300](https://togithub.com/Automattic/mongoose/issues/12300) [hasezoey](https://togithub.com/hasezoey) - docs: update Node.js EventEmitter url [#12303](https://togithub.com/Automattic/mongoose/issues/12303) [rainrisa](https://togithub.com/rainrisa) ### [`v6.5.2`](https://togithub.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#652--2022-08-09) [Compare Source](https://togithub.com/Automattic/mongoose/compare/6.5.1...6.5.2) \================== - fix(aggregate): avoid throwing error when disconnecting with change stream open [#12201](https://togithub.com/Automattic/mongoose/issues/12201) [ramos-ph](https://togithub.com/ramos-ph) - fix(query): overwrite top-level key if using Query.prototype.set() to set to undefined [#12155](https://togithub.com/Automattic/mongoose/issues/12155) - fix(query): shallow clone options before modifying [#12176](https://togithub.com/Automattic/mongoose/issues/12176) - fix(types): auto schema type inference on `Connection.prototype.model()` [#12240](https://togithub.com/Automattic/mongoose/issues/12240) [hasezoey](https://togithub.com/hasezoey) - fix(types): better typescript support for schema plugins [#12139](https://togithub.com/Automattic/mongoose/issues/12139) [emiljanitzek](https://togithub.com/emiljanitzek) - fix(types): make bulkWrite() type param optional [#12221](https://togithub.com/Automattic/mongoose/issues/12221) [#12212](https://togithub.com/Automattic/mongoose/issues/12212) - docs: misc cleanup [#12199](https://togithub.com/Automattic/mongoose/issues/12199) [hasezoey](https://togithub.com/hasezoey) - docs: highlight current top-most visible header in navbar [#12222](https://togithub.com/Automattic/mongoose/issues/12222) [hasezoey](https://togithub.com/hasezoey) - docs(populate): improve examples for Document.prototype.populate() [#12111](https://togithub.com/Automattic/mongoose/issues/12111) - docs(middleware): clarify document vs model in middleware docs [#12113](https://togithub.com/Automattic/mongoose/issues/12113) ### [`v6.5.1`](https://togithub.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#651--2022-08-03) [Compare Source](https://togithub.com/Automattic/mongoose/compare/6.5.0...6.5.1) \================== - fix(timestamps): set timestamps on child schema when child schema has timestamps: true but parent schema does not [#12119](https://togithub.com/Automattic/mongoose/issues/12119) - fix(schema+timestamps): handle insertMany() with timestamps and discriminators [#12150](https://togithub.com/Automattic/mongoose/issues/12150) - fix(model+query): handle populate with lean transform that deletes \_id [#12143](https://togithub.com/Automattic/mongoose/issues/12143) - fix(types): allow $pull with \_id [#12142](https://togithub.com/Automattic/mongoose/issues/12142) - fix(types): add schema plugin option inference [#12196](https://togithub.com/Automattic/mongoose/issues/12196) [hasezoey](https://togithub.com/hasezoey) - fix(types): pass type to mongodb bulk write operation [#12167](https://togithub.com/Automattic/mongoose/issues/12167) [emiljanitzek](https://togithub.com/emiljanitzek) - fix(types): map correct generics from model to schema [#12125](https://togithub.com/Automattic/mongoose/issues/12125) [emiljanitzek](https://togithub.com/emiljanitzek) - fix(types): avoid baffling circular reference when using PopulatedDoc with a bidirectional reference [#12136](https://togithub.com/Automattic/mongoose/issues/12136) - fix(types): allow using path with $count [#12149](https://togithub.com/Automattic/mongoose/issues/12149) - docs(compatibility): change to use a table [#12200](https://togithub.com/Automattic/mongoose/issues/12200) [hasezoey](https://togithub.com/hasezoey) - docs(api_split.pug): add "code" to sidebar entries [#12153](https://togithub.com/Automattic/mongoose/issues/12153) [hasezoey](https://togithub.com/hasezoey) - docs: add "code" to Headers (and index list) [#12152](https://togithub.com/Automattic/mongoose/issues/12152) [hasezoey](https://togithub.com/hasezoey) ### [`v6.5.0`](https://togithub.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#650--2022-07-26) [Compare Source](https://togithub.com/Automattic/mongoose/compare/6.4.7...6.5.0) \================== - perf(document): avoid creating unnecessary empty objects when creating a state machine [#11988](https://togithub.com/Automattic/mongoose/issues/11988) - feat: upgrade mongodb driver -> 4.8.1 [#12103](https://togithub.com/Automattic/mongoose/issues/12103) [AbdelrahmanHafez](https://togithub.com/AbdelrahmanHafez) - feat(model): allow passing timestamps option to Model.bulkSave(...) [#12082](https://togithub.com/Automattic/mongoose/issues/12082) [AbdelrahmanHafez](https://togithub.com/AbdelrahmanHafez) - feat(model): add castObject() function that casts a POJO to the model's schema [#11945](https://togithub.com/Automattic/mongoose/issues/11945) - feat(document): add $inc() helper that increments numeric paths [#12115](https://togithub.com/Automattic/mongoose/issues/12115) - feat(schema): add schema level lean option [IslandRhythms](https://togithub.com/IslandRhythms) - feat(schema): add global id option to disable id on schemas [#12067](https://togithub.com/Automattic/mongoose/issues/12067) [IslandRhythms](https://togithub.com/IslandRhythms) - fix(connection): re-run Model.init() if re-connecting after explicitly closing a connection [#12130](https://togithub.com/Automattic/mongoose/issues/12130) - feat(model): add applyDefaults() helper that allows applying defaults to document or POJO [#11945](https://togithub.com/Automattic/mongoose/issues/11945) - feat(model): allow calling hydrate() with { setters: true } [#11653](https://togithub.com/Automattic/mongoose/issues/11653) - feat(model): add hydrate option to Model.watch() to automatically hydrate fullDocument [#12121](https://togithub.com/Automattic/mongoose/issues/12121) - feat(types): add support for automatically typed virtuals in schemas [#11908](https://togithub.com/Automattic/mongoose/issues/11908) [mohammad0-0ahmad](https://togithub.com/mohammad0-0ahmad) ### [`v6.4.7`](https://togithub.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#647--2022-07-25) [Compare Source](https://togithub.com/Automattic/mongoose/compare/6.4.6...6.4.7) \================== - fix(virtualtype): use $locals for default virtual getter/setter rather than top-level doc [#12124](https://togithub.com/Automattic/mongoose/issues/12124) - fix(document): call subdocument getters if child schema has getters: true [#12105](https://togithub.com/Automattic/mongoose/issues/12105) - fix(schematype): actually always return "this" where specified [#12141](https://togithub.com/Automattic/mongoose/issues/12141) [hasezoey](https://togithub.com/hasezoey) - fix(types): correct return value for Model.exists() [#12094](https://togithub.com/Automattic/mongoose/issues/12094) - docs(guides): add link to advanced schemas doc [#12073](https://togithub.com/Automattic/mongoose/issues/12073) - docs: handle [@see](https://togithub.com/see) in jsdoc [#12144](https://togithub.com/Automattic/mongoose/issues/12144) [hasezoey](https://togithub.com/hasezoey) - docs: make use of the deprecated tag available in jsdoc for documentation [#12080](https://togithub.com/Automattic/mongoose/issues/12080) [hasezoey](https://togithub.com/hasezoey) - docs(api_split): add basic DEPRECATED output [#12146](https://togithub.com/Automattic/mongoose/issues/12146) [hasezoey](https://togithub.com/hasezoey) - docs: various jsdoc cleanup [#12140](https://togithub.com/Automattic/mongoose/issues/12140) [hasezoey](https://togithub.com/hasezoey) - docs(api_split.pug): add "code" to parameter name [#12145](https://togithub.com/Automattic/mongoose/issues/12145) [hasezoey](https://togithub.com/hasezoey) ### [`v6.4.6`](https://togithub.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#646--2022-07-20) [Compare Source](https://togithub.com/Automattic/mongoose/compare/6.4.5...6.4.6) \================== - fix(schema): disallow setting **proto** when creating schema with dotted properties [#12085](https://togithub.com/Automattic/mongoose/issues/12085) - fix(document): avoid mutating original object passed to $set() when applying defaults to nested properties [#12102](https://togithub.com/Automattic/mongoose/issues/12102) - fix(query): apply lean transform option to top-level document [#12093](https://togithub.com/Automattic/mongoose/issues/12093) - docs(migrating_to\_6): correct example for `isObjectIdOrHexString()` [#12123](https://togithub.com/Automattic/mongoose/issues/12123) [LokeshKanumoori](https://togithub.com/LokeshKanumoori) ### [`v6.4.5`](https://togithub.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#645--2022-07-18) [Compare Source](https://togithub.comConfiguration
📅 Schedule: Branch creation - "" (UTC), 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.