Repository navigation
perf: avoid copying arguments on every call - #47
Merged
Merged
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
AbdelrahmanHafez
approved these changes
Oct 11, 2026
vkarpov15
added a commit
to Automattic/mongoose
that referenced
this pull request
Oct 12, 2026
…kareem perf: upgrade to kareem@3.4.1 for mongoosejs/kareem#47
opensource-fork-sync Bot
pushed a commit
to cla7aye15I4nd/opensource-Automattic__mongoose
that referenced
this pull request
Oct 12, 2026
renovate Bot
added a commit
to LUISDASARTIMANHAS/template-server-express-node-js
that referenced
this pull request
Oct 13, 2026
This PR contains the following updates: | Package | Change | [Age](https://docs.renovatebot.com/merge-confidence/) | [Confidence](https://docs.renovatebot.com/merge-confidence/) | |---|---|---|---| | [mongoose](https://mongoosejs.com) ([source](https://redirect.github.com/Automattic/mongoose)) | [`9.11.1` → `9.11.2`](https://renovatebot.com/diffs/npm/mongoose/9.11.1/9.11.2) |  |  | --- ### Release Notes <details> <summary>Automattic/mongoose (mongoose)</summary> ### [`v9.11.2`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#9112--2026-10-12) [Compare Source](https://redirect.github.com/Automattic/mongoose/compare/9.11.1...9.11.2) \=================== - perf: avoid applying saveSubdocs and sharding plugins to subdocuments [#​16585](https://redirect.github.com/Automattic/mongoose/issues/16585) - perf: upgrade to kareem\@​3.4.1 for [mongoosejs/kareem#47](https://redirect.github.com/mongoosejs/kareem/issues/47) [#​16588](https://redirect.github.com/Automattic/mongoose/issues/16588) - fix(model): cast array filter values in bulkWrite() [#​16574](https://redirect.github.com/Automattic/mongoose/issues/16574) [#​16573](https://redirect.github.com/Automattic/mongoose/issues/16573) [OmBhandwaldar](https://redirect.github.com/OmBhandwaldar) - fix(schema): allow function messages for number min/max and string minlength [#​16579](https://redirect.github.com/Automattic/mongoose/issues/16579) [#​16572](https://redirect.github.com/Automattic/mongoose/issues/16572) [#​8512](https://redirect.github.com/Automattic/mongoose/issues/8512) [NotAFlightRisk](https://redirect.github.com/NotAFlightRisk) - types: make MergeType more efficiently handle MergeType\<A, {}> [#​16581](https://redirect.github.com/Automattic/mongoose/issues/16581) [#​16580](https://redirect.github.com/Automattic/mongoose/issues/16580) - docs: fix broken API anchors and a malformed link [#​16583](https://redirect.github.com/Automattic/mongoose/issues/16583) [SatvikMishra08](https://redirect.github.com/SatvikMishra08) </details> --- ### Configuration 📅 **Schedule**: (UTC) - Branch creation - At any time (no schedule defined) - Automerge - At any time (no schedule defined) 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/LUISDASARTIMANHAS/template-server-express-node-js). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0NC4xMzQuMSIsInVwZGF0ZWRJblZlciI6IjQ0LjEzNC4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119-->
antoinezanardi
pushed a commit
to antoinezanardi/goat-it-api
that referenced
this pull request
Oct 13, 2026
This PR contains the following updates: | Package | Change | [Age](https://docs.renovatebot.com/merge-confidence/) | [Confidence](https://docs.renovatebot.com/merge-confidence/) | |---|---|---|---| | [mongoose](https://mongoosejs.com) ([source](https://redirect.github.com/Automattic/mongoose)) | [`^9.11.1` → `^9.11.2`](https://renovatebot.com/diffs/npm/mongoose/9.11.1/9.11.2) |  |  | --- ### Release Notes <details> <summary>Automattic/mongoose (mongoose)</summary> ### [`v9.11.2`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#9112--2026-10-12) [Compare Source](https://redirect.github.com/Automattic/mongoose/compare/9.11.1...9.11.2) \=================== - perf: avoid applying saveSubdocs and sharding plugins to subdocuments [#​16585](https://redirect.github.com/Automattic/mongoose/issues/16585) - perf: upgrade to kareem\@​3.4.1 for [mongoosejs/kareem#47](https://redirect.github.com/mongoosejs/kareem/issues/47) [#​16588](https://redirect.github.com/Automattic/mongoose/issues/16588) - fix(model): cast array filter values in bulkWrite() [#​16574](https://redirect.github.com/Automattic/mongoose/issues/16574) [#​16573](https://redirect.github.com/Automattic/mongoose/issues/16573) [OmBhandwaldar](https://redirect.github.com/OmBhandwaldar) - fix(schema): allow function messages for number min/max and string minlength [#​16579](https://redirect.github.com/Automattic/mongoose/issues/16579) [#​16572](https://redirect.github.com/Automattic/mongoose/issues/16572) [#​8512](https://redirect.github.com/Automattic/mongoose/issues/8512) [NotAFlightRisk](https://redirect.github.com/NotAFlightRisk) - types: make MergeType more efficiently handle MergeType\<A, {}> [#​16581](https://redirect.github.com/Automattic/mongoose/issues/16581) [#​16580](https://redirect.github.com/Automattic/mongoose/issues/16580) - docs: fix broken API anchors and a malformed link [#​16583](https://redirect.github.com/Automattic/mongoose/issues/16583) [SatvikMishra08](https://redirect.github.com/SatvikMishra08) </details> --- ### Configuration 📅 **Schedule**: (UTC) - Branch creation - At any time (no schedule defined) - Automerge - At any time (no schedule defined) 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/antoinezanardi/goat-it-api). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0NC4xMzQuMSIsInVwZGF0ZWRJblZlciI6IjQ0LjEzNC4xIiwidGFyZ2V0QnJhbmNoIjoiZGV2ZWxvcCIsImxhYmVscyI6W119--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
alexolivier
added a commit
to cerbos/query-plan-adapters
that referenced
this pull request
Nov 12, 2026
This PR contains the following updates: | Package | Change | [Age](https://docs.renovatebot.com/merge-confidence/) | [Confidence](https://docs.renovatebot.com/merge-confidence/) | |---|---|---|---| | [mongoose](https://mongoosejs.com) ([source](https://redirect.github.com/Automattic/mongoose)) | [`9.9.2` → `9.11.4`](https://renovatebot.com/diffs/npm/mongoose/9.9.2/9.11.4) |  |  | --- > [!WARNING] > Some dependencies could not be looked up. Check the [Dependency Dashboard](../issues/15) for more information. --- ### Mongoose: Connection-level sanitizeFilter not applied [CVE-2026-125119](https://nvd.nist.gov/vuln/detail/CVE-2026-125119) / [GHSA-gg4r-jv3p-qx3c](https://redirect.github.com/advisories/GHSA-gg4r-jv3p-qx3c) <details> <summary>More information</summary> #### Details ##### Summary sanitizeFilter exists to stop query selector injection: it wraps operator objects such as `{ $ne: null }` in filter values in `$eq`, so they are matched literally. Set on a connection with `mongoose.connect()` or `createConnection(uri, { sanitizeFilter: true })`, the connection reports it as enabled but queries never apply it. An application that relies on the connection-level option and passes an attacker-controlled object into a filter therefore remains open to selector injection, and a password value of `{ $ne: null }` returns the account record without the password. ##### Details `NativeConnection#createClient()` at `lib/drivers/node-mongodb-native/connection.js:270-272` moves `options.sanitizeFilter` into `Connection.config` and deletes the original option. `Query#_castConditions()` at `lib/query.js:2413-2423` checks `Connection.options`, the global `options`, and the per-query options, but never `Connection.config`. The defense therefore does not run even though `Connection#get('sanitizeFilter')` returns true. This storage was introduced in Mongoose 6.0.0 and the same mismatch is present in 9.11.2. ##### Proof of concept ```javascript import mongoose from 'mongoose' const conn = await mongoose.createConnection('<MONGODB_URI>', { sanitizeFilter: true }).asPromise() const User = conn.model('User', new mongoose.Schema({ username: String, password: String, marker: String })) await User.create({ username: 'victim', password: 'correct-password', marker: 'PROTECTED_RECORD' }) const filter = { username: 'victim', password: { $ne: null } } console.log(conn.get('sanitizeFilter')) console.log((await User.findOne(filter).lean()).marker) ``` A control query with a literal wrong password returned no document in the same run, confirming the filter is otherwise enforced. ##### Impact Connection-level `sanitizeFilter` option is not respected. Any user that relies on connection-level config and `sanitizeFilter` to defend against query selector injection is affected. Users that set `sanitizeFilter` globally using `mongoose.set('sanitizeFilter')` or on specific queries using `Model.find().sanitizeFilter()` are not affected. #### Severity - CVSS Score: 7.5 / 10 (High) - Vector String: `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N` #### References - [https://github.com/Automattic/mongoose/security/advisories/GHSA-gg4r-jv3p-qx3c](https://redirect.github.com/Automattic/mongoose/security/advisories/GHSA-gg4r-jv3p-qx3c) - [https://nvd.nist.gov/vuln/detail/CVE-2026-125119](https://nvd.nist.gov/vuln/detail/CVE-2026-125119) - [https://github.com/Automattic/mongoose/commit/4bb659478be2f30655a7bdd78bc251bdf111cd29](https://redirect.github.com/Automattic/mongoose/commit/4bb659478be2f30655a7bdd78bc251bdf111cd29) - [https://github.com/Automattic/mongoose/commit/4f4f9a79f860786a54133bee2c9af967ec691491](https://redirect.github.com/Automattic/mongoose/commit/4f4f9a79f860786a54133bee2c9af967ec691491) - [https://github.com/Automattic/mongoose/commit/83eda6af1489e9ef60bb8eee8cf9ee005771b9d5](https://redirect.github.com/Automattic/mongoose/commit/83eda6af1489e9ef60bb8eee8cf9ee005771b9d5) - [https://github.com/Automattic/mongoose/commit/b8970c25998c23fbccd17f76c0398b902ff4911d](https://redirect.github.com/Automattic/mongoose/commit/b8970c25998c23fbccd17f76c0398b902ff4911d) - [https://github.com/Automattic/mongoose/releases/tag/6.13.12](https://redirect.github.com/Automattic/mongoose/releases/tag/6.13.12) - [https://github.com/Automattic/mongoose/releases/tag/7.8.13](https://redirect.github.com/Automattic/mongoose/releases/tag/7.8.13) - [https://github.com/Automattic/mongoose/releases/tag/8.24.7](https://redirect.github.com/Automattic/mongoose/releases/tag/8.24.7) - [https://github.com/Automattic/mongoose/releases/tag/9.11.4](https://redirect.github.com/Automattic/mongoose/releases/tag/9.11.4) - [https://github.com/advisories/GHSA-gg4r-jv3p-qx3c](https://redirect.github.com/advisories/GHSA-gg4r-jv3p-qx3c) This data is provided by the [GitHub Advisory Database](https://redirect.github.com/advisories/GHSA-gg4r-jv3p-qx3c) ([CC-BY 4.0](https://redirect.github.com/github/advisory-database/blob/main/LICENSE.md)). </details> --- ### Mongoose: Prototype pollution via Schema.prototype.virtual() [CVE-2026-125118](https://nvd.nist.gov/vuln/detail/CVE-2026-125118) / [GHSA-6972-9mcm-vhwj](https://redirect.github.com/advisories/GHSA-6972-9mcm-vhwj) <details> <summary>More information</summary> #### Details ##### Summary Prototype pollution via Schema.prototype.virtual() — the 2022 fix for CVE-2022-2564 / CVE-2022-24304 protected Schema.path()/add() but never virtual(), so the same class of bug is still exploitable in all maintained release lines. ##### Details In lib/schema.js, Schema.prototype.virtual() (defined at line 2643) builds the virtual path via: ```javascript virtuals[name] = parts.reduce(function(mem, part, i) { mem[part] || (mem[part] = (i === parts.length - 1) ? new VirtualType(options, name) : {}); return mem[part]; }, this.tree); // lines 2755-2759 ``` Unlike `path()`/`add()`, `virtual()` never received the `specialProperties` check added for CVE-2022-2564/CVE-2022-24304 (`lib/schema.js` lines 806, 1308, 1331). A path containing `__proto__`/`constructor`/`prototype` segments resolves through the prototype chain and writes onto `Object.prototype` / `Function.prototype`. ##### Proof of concept ```javascript const mongoose = require('mongoose'); const schema = new mongoose.Schema({}); schema.virtual('__proto__.polluted'); console.log(({}).polluted); // VirtualType instance console.log(Object.prototype.hasOwnProperty('polluted')); // true console.log(Object.getOwnPropertyDescriptor( Object.prototype, 'polluted').enumerable); // true schema.virtual('constructor.prototype.opol'); console.log(({}).opol); // true schema.virtual('hasOwnProperty.__proto__.fpol'); console.log((function(){}).fpol); // Function.prototype polluted ``` ##### Impact Attacker-influenced schema field names (dynamic schemas, CMS form builders, schema-as-code) allow pollution of Object.prototype (own, enumerable keys visible on every object — e.g. `({}).isAdmin` checks can be spoofed) and Function.prototype (a known gadget primitive in server-side JS). #### Severity - CVSS Score: 6.5 / 10 (Medium) - Vector String: `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:L` #### References - [https://github.com/Automattic/mongoose/security/advisories/GHSA-6972-9mcm-vhwj](https://redirect.github.com/Automattic/mongoose/security/advisories/GHSA-6972-9mcm-vhwj) - [https://nvd.nist.gov/vuln/detail/CVE-2026-125118](https://nvd.nist.gov/vuln/detail/CVE-2026-125118) - [https://github.com/Automattic/mongoose/commit/318f7e09dd363a1dfddb8180878488dccd2796d1](https://redirect.github.com/Automattic/mongoose/commit/318f7e09dd363a1dfddb8180878488dccd2796d1) - [https://github.com/Automattic/mongoose/commit/74df7769b5a8d89c4413b764029911ee915ea467](https://redirect.github.com/Automattic/mongoose/commit/74df7769b5a8d89c4413b764029911ee915ea467) - [https://github.com/Automattic/mongoose/commit/7a2a6567abbb72c0430c8cc5b7942141844fecff](https://redirect.github.com/Automattic/mongoose/commit/7a2a6567abbb72c0430c8cc5b7942141844fecff) - [https://github.com/Automattic/mongoose/commit/fb467e6d33174293dc0360649f20ce68d99117a9](https://redirect.github.com/Automattic/mongoose/commit/fb467e6d33174293dc0360649f20ce68d99117a9) - [https://github.com/Automattic/mongoose/releases/tag/6.13.12](https://redirect.github.com/Automattic/mongoose/releases/tag/6.13.12) - [https://github.com/Automattic/mongoose/releases/tag/7.8.13](https://redirect.github.com/Automattic/mongoose/releases/tag/7.8.13) - [https://github.com/Automattic/mongoose/releases/tag/8.24.7](https://redirect.github.com/Automattic/mongoose/releases/tag/8.24.7) - [https://github.com/Automattic/mongoose/releases/tag/9.11.4](https://redirect.github.com/Automattic/mongoose/releases/tag/9.11.4) - [https://github.com/advisories/GHSA-6972-9mcm-vhwj](https://redirect.github.com/advisories/GHSA-6972-9mcm-vhwj) This data is provided by the [GitHub Advisory Database](https://redirect.github.com/advisories/GHSA-6972-9mcm-vhwj) ([CC-BY 4.0](https://redirect.github.com/github/advisory-database/blob/main/LICENSE.md)). </details> --- ### Mongoose walks into inherited properties when hydrating, setting, and merging, allowing overwrites of built-in functions (denial of service) and shared schema state [CVE-2026-125117](https://nvd.nist.gov/vuln/detail/CVE-2026-125117) / [GHSA-8332-j7wj-wjw4](https://redirect.github.com/advisories/GHSA-8332-j7wj-wjw4) <details> <summary>More information</summary> #### Details ##### Summary Three Mongoose code paths copy data into objects by property name without checking whether the property is the object's own or inherited from its prototype: 1. Loading a document from the database (`init()`, also used by `Model.hydrate()`) 2. Setting a dotted path on a document (`$__set`, used by `new Model(obj)`, `doc.set()` and `doc.$set()`) 3. Merging update documents (`utils.mergeClone`, used by `findOneAndReplace()`, chained update calls and `Query.prototype.merge()`) When a key names an inherited property, such as `toString` or `valueOf`, or a document internal such as `$__schema`, Mongoose writes into the shared object behind that property. The data comes from the attacker. - **Denial of service.** For example, `{ "toString": { "call": 1 } }` overwrites `Object.prototype.toString.call`. Mongoose and most other libraries rely on `Object.prototype.toString.call()`. After the overwrite, every later query in the process throws `TypeError: _toString.call is not a function` until the process restarts. This includes queries on unrelated models. - **Changing shared schema state.** Through a subdocument with `strict: false`, a path such as `profile.$__schema.paths.email.validators` reaches the subdocument's schema, which every document shares. Setting it to `[]` removes the `required` validator for every document in the process. Mongoose already blocked `__proto__`, `constructor` and `prototype`, so these bugs cannot add properties to `Object.prototype` itself. They can still overwrite methods and properties of shared built-in functions and of Mongoose's internal objects. ##### Details ##### 1. Loading documents: `init()` ```js if (!schemaType && utils.isPOJO(value)) { // assume nested object if (!doc[i]) { doc[i] = {}; ... } init(self, value, doc[i], opts, path + '.'); } ``` For a stored field named `toString`, `doc[i]` is the inherited `Object.prototype.toString`. It is truthy, so `init()` recurses into that function and copies the stored subfields onto it. This runs for every document Mongoose loads: `find()`, `findOne()`, cursors, populated documents and `Model.hydrate()`. It runs whatever the `strict` setting, and it applies to top-level and nested paths alike. `lean()` queries are not affected. A malicious document can get into the collection in several ways: - through a model with `strict: false`, for example `new Model(req.body).save()`; - through another application or the raw MongoDB driver; - through any update that writes arbitrary keys. ##### 2. Setting dotted paths: `$__set` When it walks a dotted path, `$__set` read `obj[parts[i]]` and descended into whatever it found. That included inherited functions, such as `Object.prototype.toString` on a plain object or `Document.prototype.toObject` on a subdocument. On subdocuments it also included non-function internals that are prototype getters, such as `$__schema`, `schema`, `$__middleware` and `$__schemaTypeOptions`. Those point at objects that every document of the model shares. Attacker-controlled input reaches this path through: - **A `Mixed` path on a default, strict schema:** `new Model({ "mixed.toString.call": 1 })`, or `doc.set({ "mixed.toString.call": 1 })`. Nothing needs to be saved. - **Any root path on a schema with `strict: false`:** for example `doc.set('toString.call', 1)`. - **A subdocument with `strict: false`**, when the application passes a user-controlled path to `doc.set(path, value)`: for example `doc.set('profile.$__schema.paths.email.validators', [])`. ##### 3. Merging updates: `utils.mergeClone` ```js if (typeof to[key] === 'undefined') { to[key] = clone(fromObj[key]); } else if (isObject(val)) { mergeClone(to[key], val); // to[key] may be an inherited built-in } ``` `to[key]` was read without an own-property check, so a key such as `toString` recursed into `Object.prototype.toString`. This affects: - **`Model.findOneAndReplace(filter, replacement)`.** It always merges the replacement into the query's update, so a single call with an untrusted replacement is enough. - **Update calls chained onto a query that already has an update.** For example `Model.updateOne(filter, { $set: {...} }).updateOne({}, untrustedUpdate)`, the same pattern with `findOneAndUpdate()`, or middleware that calls `this.updateOne(...)`. - **`Query.prototype.merge()`** with a source query whose update came from untrusted input. ##### Proof of concept ```js const mongoose = require('mongoose'); const { Schema } = mongoose; // 2. Setting dotted paths: a Mixed path on a default strict schema, nothing saved const Item = mongoose.model('Item', new Schema({ name: String, meta: {} })); new Item(JSON.parse('{"meta.toString.call": 1}')); // e.g. new Item(req.body) console.log(typeof Object.prototype.toString.call); // 'number' // From here on, every query in the process fails: // TypeError: _toString.call is not a function ``` ```js // 1. Loading documents: a stored field named after an Object.prototype method const Loose = mongoose.model('Loose', new Schema({ name: String }, { strict: false })); await new Loose(JSON.parse('{"name":"evil","toString":{"call":1}}')).save(); await Loose.findOne({ name: 'evil' }); // any later read of this document await OtherModel.findOne(); // TypeError: _toString.call is not a function ``` ```js // 3. Merging updates: a single findOneAndReplace() call with an untrusted replacement const Doc = mongoose.model('Doc', new Schema({ name: String })); Doc.findOneAndReplace({}, JSON.parse('{"toString":{"call":1}}')); console.log(typeof Object.prototype.toString.call); // 'number' ``` ```js // 2. Setting dotted paths: changing the shared subdocument schema const User = mongoose.model('User', new Schema({ profile: new Schema({ email: { type: String, required: true } }, { strict: false }) })); // e.g. JSON-patch style endpoint: doc.set(req.body.path, req.body.value) new User({ profile: { email: 'a@b.c' } }).set('profile.$__schema.paths.email.validators', []); await new User({ profile: {} }).validate(); // resolves: `required` removed for every document ``` ##### Impact - **Denial of service (paths 1, 2 and 3).** One request overwrites `Object.prototype.toString.call`. After that, every query in the process fails, and so does much other code, until the process restarts. Ways in: - `new Model(req.body)` on any schema with a `Mixed` path; - `findOneAndReplace()` with an untrusted replacement; - reading one stored document that contains a field such as `{ "toString": { "call": 1 } }`. In the stored-document case, the attacker does not need any write path through Mongoose at the moment of the attack. Any later read of that document triggers the overwrite. If the document is read on startup or by a scheduled job, the application can be kept down. - **Changes to shared state (path 2, `strict: false` subdocuments).** An attacker who controls the path passed to `doc.set(path, value)` can change a subdocument schema that every document shares. For example, they can remove validators or change schema options for every later document in the process. - **Properties on built-in functions.** More generally, an attacker can attach properties they choose to built-in functions such as `Object.prototype.toString`, `Object.prototype.valueOf` and `Function.prototype.call`. Any other code that reads properties of those functions sees the attacker's values. #### Severity - CVSS Score: 8.2 / 10 (High) - Vector String: `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:H` #### References - [https://github.com/Automattic/mongoose/security/advisories/GHSA-8332-j7wj-wjw4](https://redirect.github.com/Automattic/mongoose/security/advisories/GHSA-8332-j7wj-wjw4) - [https://nvd.nist.gov/vuln/detail/CVE-2026-125117](https://nvd.nist.gov/vuln/detail/CVE-2026-125117) - [https://github.com/Automattic/mongoose/commit/18b5513dd463731a2caf0d3395ef1d9eb0735f50](https://redirect.github.com/Automattic/mongoose/commit/18b5513dd463731a2caf0d3395ef1d9eb0735f50) - [https://github.com/Automattic/mongoose/commit/2a195d19a4dd240f039a0a226614d5804e8187ee](https://redirect.github.com/Automattic/mongoose/commit/2a195d19a4dd240f039a0a226614d5804e8187ee) - [https://github.com/Automattic/mongoose/commit/3cb702b8d079c3e267f0b10f41673a1590f703c8](https://redirect.github.com/Automattic/mongoose/commit/3cb702b8d079c3e267f0b10f41673a1590f703c8) - [https://github.com/Automattic/mongoose/commit/85cf897105edfeb5f56be42a18a68704434cac82](https://redirect.github.com/Automattic/mongoose/commit/85cf897105edfeb5f56be42a18a68704434cac82) - [https://github.com/Automattic/mongoose/commit/8cee51beead554df1f3d05645edb439c69eb2a9b](https://redirect.github.com/Automattic/mongoose/commit/8cee51beead554df1f3d05645edb439c69eb2a9b) - [https://github.com/Automattic/mongoose/commit/8eb74cb4a550cbe0225963b07aebacbd999d4b74](https://redirect.github.com/Automattic/mongoose/commit/8eb74cb4a550cbe0225963b07aebacbd999d4b74) - [https://github.com/Automattic/mongoose/releases/tag/6.13.12](https://redirect.github.com/Automattic/mongoose/releases/tag/6.13.12) - [https://github.com/Automattic/mongoose/releases/tag/7.8.13](https://redirect.github.com/Automattic/mongoose/releases/tag/7.8.13) - [https://github.com/Automattic/mongoose/releases/tag/8.24.7](https://redirect.github.com/Automattic/mongoose/releases/tag/8.24.7) - [https://github.com/Automattic/mongoose/releases/tag/9.11.4](https://redirect.github.com/Automattic/mongoose/releases/tag/9.11.4) - [https://github.com/advisories/GHSA-8332-j7wj-wjw4](https://redirect.github.com/advisories/GHSA-8332-j7wj-wjw4) This data is provided by the [GitHub Advisory Database](https://redirect.github.com/advisories/GHSA-8332-j7wj-wjw4) ([CC-BY 4.0](https://redirect.github.com/github/advisory-database/blob/main/LICENSE.md)). </details> --- ### Mongoose: Discriminator key values matching inherited properties (e.g. __t: 'constructor') bypass schema casting and can poison collections [CVE-2026-125116](https://nvd.nist.gov/vuln/detail/CVE-2026-125116) / [GHSA-wr5m-5jph-8m96](https://redirect.github.com/advisories/GHSA-wr5m-5jph-8m96) <details> <summary>More information</summary> #### Details ##### Summary Mongoose chooses which discriminator model or schema to use by looking up the discriminator key value (`__t` by default) in a plain object of registered discriminators, for example `Model.discriminators[doc.__t]`. That value comes from user documents and query filters. Because the lookup did not check own properties, a value that names a property inherited from `Object.prototype` resolves to that inherited value instead of a discriminator. Examples are `'constructor'`, `'toString'` and `'hasOwnProperty'`. - `__t: 'constructor'` resolves to the global `Object` function. Mongoose then calls `new Object(doc)`, which returns the raw user object where a Mongoose document is expected. - `__t: 'toString'` and similar names resolve to built-in functions that throw when used as a constructor or schema. The most serious effect: through `bulkWrite()` `insertOne` with `skipValidation: true`, the raw user object is stored as-is, without schema casting or `strict` filtering. After that, every query that returns the stored document throws, until the document is removed from the database. ##### Details The registries that hold discriminators are plain objects: `Model.discriminators`, `schema.discriminators`, and the embedded discriminator registries on document arrays and single nested subdocuments. Several code paths indexed them directly with a value taken from the document or filter: | Code path | Input | |---|---| | Model constructor (`new Model(doc)`) | document | | `Model.create()`, `insertMany()`, `bulkWrite()`, `bulkSave()` | documents | | Hydrating query results (`find()`, `findOne()`, etc.) and `Model.hydrate()` | stored documents | | Casting query filters, including flat paths such as `'events.__t'` and `$elemMatch` | query filter | | Casting updates and array filters | update filter, `arrayFilters` | | Document array `push()` / `create()`, document array and single nested casting | subdocuments | | Populate on embedded discriminators | stored subdocuments | `getDiscriminatorByValue()` already iterated the registry's own keys safely. But most callers tried the direct lookup first and only fell back to it afterwards, so a truthy inherited value took precedence. The lookups only read inherited properties. They do not write to `Object.prototype` or any other shared object, and they do not change in-memory state that affects other requests. This is NOT a prototype pollution vector. ##### Proof of concept ```js const mongoose = require('mongoose'); const Base = mongoose.model('Base', new mongoose.Schema({ name: String, age: Number })); Base.discriminator('Child', new mongoose.Schema({ extra: String })); // Type confusion: the "document" is the raw input object const doc = new Base({ name: 'x', __t: 'constructor' }); console.log(doc instanceof mongoose.Document); // false ``` ```js // Schema bypass and persistent poison document via bulkWrite + skipValidation await Base.bulkWrite([{ insertOne: { document: { name: 'x', age: 'not a number', notInSchema: true, __t: 'constructor' } } }], { skipValidation: true }); // Stored verbatim: { age: 'not a number', notInSchema: true, __t: 'constructor', ... } await Base.find(); // throws: Cannot read properties of undefined (reading 'eachPath') ``` ##### Impact - **Crashing the request.** An attacker who controls the discriminator key of a document or filter can make the request fail. In most code paths that sent the value, this means a `TypeError` or a non-document object returned to application code. Ways in include `Model.create(req.body)`, `new Model(req.body)`, `Model.find(req.query)`-style filters, and pushing user input onto embedded discriminator arrays. The effect is limited to the request carrying the value. - **Schema bypass on `bulkWrite({ skipValidation: true })`.** When an application passes untrusted documents to `bulkWrite()` `insertOne` with `skipValidation: true`, the raw object is stored without casting or `strict` filtering. Fields the schema would normally strip are persisted, such as an `isAdmin` that isn't in the schema. Fields with wrong types are also persisted. - **Persistent denial of service for queries.** A stored document with such a discriminator key value makes hydration throw. Every query that returns that document fails, for all users, until the document is deleted directly in the database. Besides the `bulkWrite()` path above, the document can get into the collection through another application, the raw MongoDB driver, or any other writer that does not go through Mongoose casting. This issue doesn't let an attacker modify `Object.prototype`, built-in functions, schemas or other shared in-memory state. The schema bypass requires the application to opt in to `skipValidation` with untrusted input. #### Severity - CVSS Score: 4.8 / 10 (Medium) - Vector String: `CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:L/A:L` #### References - [https://github.com/Automattic/mongoose/security/advisories/GHSA-wr5m-5jph-8m96](https://redirect.github.com/Automattic/mongoose/security/advisories/GHSA-wr5m-5jph-8m96) - [https://nvd.nist.gov/vuln/detail/CVE-2026-125116](https://nvd.nist.gov/vuln/detail/CVE-2026-125116) - [https://github.com/Automattic/mongoose/commit/0ecd8040d9b446f36535d79938c130c800f91766](https://redirect.github.com/Automattic/mongoose/commit/0ecd8040d9b446f36535d79938c130c800f91766) - [https://github.com/Automattic/mongoose/commit/18afab75bea861f625b7c5b54635c84567ec566c](https://redirect.github.com/Automattic/mongoose/commit/18afab75bea861f625b7c5b54635c84567ec566c) - [https://github.com/Automattic/mongoose/commit/390453c8ce1b36b6cfd1e63432a910da1f3d81d5](https://redirect.github.com/Automattic/mongoose/commit/390453c8ce1b36b6cfd1e63432a910da1f3d81d5) - [https://github.com/Automattic/mongoose/commit/8cee51beead554df1f3d05645edb439c69eb2a9b](https://redirect.github.com/Automattic/mongoose/commit/8cee51beead554df1f3d05645edb439c69eb2a9b) - [https://github.com/Automattic/mongoose/commit/b26c43554233134ea978c5852babe13be858b2cf](https://redirect.github.com/Automattic/mongoose/commit/b26c43554233134ea978c5852babe13be858b2cf) - [https://github.com/Automattic/mongoose/commit/b68f90734b50cd22c89a669c8ca1469d7234b296](https://redirect.github.com/Automattic/mongoose/commit/b68f90734b50cd22c89a669c8ca1469d7234b296) - [https://github.com/Automattic/mongoose/releases/tag/6.13.12](https://redirect.github.com/Automattic/mongoose/releases/tag/6.13.12) - [https://github.com/Automattic/mongoose/releases/tag/7.8.13](https://redirect.github.com/Automattic/mongoose/releases/tag/7.8.13) - [https://github.com/Automattic/mongoose/releases/tag/8.24.7](https://redirect.github.com/Automattic/mongoose/releases/tag/8.24.7) - [https://github.com/Automattic/mongoose/releases/tag/9.11.4](https://redirect.github.com/Automattic/mongoose/releases/tag/9.11.4) - [https://github.com/advisories/GHSA-wr5m-5jph-8m96](https://redirect.github.com/advisories/GHSA-wr5m-5jph-8m96) This data is provided by the [GitHub Advisory Database](https://redirect.github.com/advisories/GHSA-wr5m-5jph-8m96) ([CC-BY 4.0](https://redirect.github.com/github/advisory-database/blob/main/LICENSE.md)). </details> --- ### Release Notes <details> <summary>Automattic/mongoose (mongoose)</summary> ### [`v9.11.4`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#9114--2026-10-23) [Compare Source](https://redirect.github.com/Automattic/mongoose/compare/9.11.3...9.11.4) \=================== - fix: avoid walking into inherited properties like `toString` when hydrating documents, setting dotted paths, and merging updates - fix: only use own properties when looking up discriminators by key - fix(schema): disallow setting special properties via virtual() - fix(query): respect connection-level sanitizeFilter in queries - fix(query): disallow special properties like `__proto__` as paths in where() and mod() - fix(deps): upgrade mquery -> 6.0.1 to avoid prototype pollution with query helpers like gt() and in() ### [`v9.11.3`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#9113--2026-10-21) [Compare Source](https://redirect.github.com/Automattic/mongoose/compare/9.11.2...9.11.3) \=================== - fix(update): honor overwriteImmutable in upserts and nested timestamps [#​16614](https://redirect.github.com/Automattic/mongoose/issues/16614) [#​15781](https://redirect.github.com/Automattic/mongoose/issues/15781) [#​8619](https://redirect.github.com/Automattic/mongoose/issues/8619) [AbdelrahmanHafez](https://redirect.github.com/AbdelrahmanHafez) - fix(model): stop Model.validate() crashing on missing nested objects [#​16600](https://redirect.github.com/Automattic/mongoose/issues/16600) [NotAFlightRisk](https://redirect.github.com/NotAFlightRisk) - fix(connection): don't disable autoIndex/autoCreate for a primary ReadPreference instance [#​16592](https://redirect.github.com/Automattic/mongoose/issues/16592) [NgoQuocViet2001](https://redirect.github.com/NgoQuocViet2001) - docs: remove references to MongoDB versions older than 6.x [#​16593](https://redirect.github.com/Automattic/mongoose/issues/16593) ### [`v9.11.2`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#9112--2026-10-12) [Compare Source](https://redirect.github.com/Automattic/mongoose/compare/9.11.1...9.11.2) \=================== - perf: avoid applying saveSubdocs and sharding plugins to subdocuments [#​16585](https://redirect.github.com/Automattic/mongoose/issues/16585) - perf: upgrade to kareem\@​3.4.1 for [mongoosejs/kareem#47](https://redirect.github.com/mongoosejs/kareem/issues/47) [#​16588](https://redirect.github.com/Automattic/mongoose/issues/16588) - fix(model): cast array filter values in bulkWrite() [#​16574](https://redirect.github.com/Automattic/mongoose/issues/16574) [#​16573](https://redirect.github.com/Automattic/mongoose/issues/16573) [OmBhandwaldar](https://redirect.github.com/OmBhandwaldar) - fix(schema): allow function messages for number min/max and string minlength [#​16579](https://redirect.github.com/Automattic/mongoose/issues/16579) [#​16572](https://redirect.github.com/Automattic/mongoose/issues/16572) [#​8512](https://redirect.github.com/Automattic/mongoose/issues/8512) [NotAFlightRisk](https://redirect.github.com/NotAFlightRisk) - types: make MergeType more efficiently handle MergeType\<A, {}> [#​16581](https://redirect.github.com/Automattic/mongoose/issues/16581) [#​16580](https://redirect.github.com/Automattic/mongoose/issues/16580) - docs: fix broken API anchors and a malformed link [#​16583](https://redirect.github.com/Automattic/mongoose/issues/16583) [SatvikMishra08](https://redirect.github.com/SatvikMishra08) ### [`v9.11.1`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#9111--2026-10-07) [Compare Source](https://redirect.github.com/Automattic/mongoose/compare/9.11.0...9.11.1) \=================== - fix(document): call recursive toObject() when setting a path to a nested object [#​16571](https://redirect.github.com/Automattic/mongoose/issues/16571) - fix(update): keep casting array filters after a path not in the schema [#​16558](https://redirect.github.com/Automattic/mongoose/issues/16558) [giaBaoJS](https://redirect.github.com/giaBaoJS) - fix(document): apply flattenDecimals when toObject() takes the shallow fast path [#​16569](https://redirect.github.com/Automattic/mongoose/issues/16569) [#​16568](https://redirect.github.com/Automattic/mongoose/issues/16568) [jeremyml](https://redirect.github.com/jeremyml) - fix(query): cast operators under $not inside $elemMatch on primitive arrays [#​16542](https://redirect.github.com/Automattic/mongoose/issues/16542) [#​13880](https://redirect.github.com/Automattic/mongoose/issues/13880) [breken-ai](https://redirect.github.com/breken-ai) - fix(query): use embedded discriminator schema when filter selects the key with $eq or $in [#​16543](https://redirect.github.com/Automattic/mongoose/issues/16543) [breken-ai](https://redirect.github.com/breken-ai) - fix(documentarray): don't pass arrayPathIndex to subdocuments when initializing nested document arrays [#​16546](https://redirect.github.com/Automattic/mongoose/issues/16546) [Mohamed-Elshesheny](https://redirect.github.com/Mohamed-Elshesheny) - fix(cursor): await driver cleanup when destroying query cursors [#​16562](https://redirect.github.com/Automattic/mongoose/issues/16562) [#​16560](https://redirect.github.com/Automattic/mongoose/issues/16560) [IbrahimHafez1](https://redirect.github.com/IbrahimHafez1) - fix(cursor): reject getDriverCursor after initialization errors [#​16563](https://redirect.github.com/Automattic/mongoose/issues/16563) [#​16561](https://redirect.github.com/Automattic/mongoose/issues/16561) [IbrahimHafez1](https://redirect.github.com/IbrahimHafez1) - types(schema): treat Int32 paths as number [#​16565](https://redirect.github.com/Automattic/mongoose/issues/16565) [#​16564](https://redirect.github.com/Automattic/mongoose/issues/16564) [lazerg](https://redirect.github.com/lazerg) - types(models): align UpdateOneModel and UpdateManyModel update typing with UpdateQuery [#​16559](https://redirect.github.com/Automattic/mongoose/issues/16559) [#​16545](https://redirect.github.com/Automattic/mongoose/issues/16545) [aipd506](https://redirect.github.com/aipd506) ### [`v9.11.0`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#9110--2026-10-05) [Compare Source](https://redirect.github.com/Automattic/mongoose/compare/9.10.4...9.11.0) \=================== - feat: use MongoDB Node.js driver 7.7.x [#​16550](https://redirect.github.com/Automattic/mongoose/issues/16550) - feat(query): add Query.prototype.findAndCount() for composable paginated queries [#​16508](https://redirect.github.com/Automattic/mongoose/issues/16508) [#​16504](https://redirect.github.com/Automattic/mongoose/issues/16504) [lokeshllkumar](https://redirect.github.com/lokeshllkumar) - fix: avoid double-calling validators on document arrays underneath nested paths [#​16484](https://redirect.github.com/Automattic/mongoose/issues/16484) [#​16291](https://redirect.github.com/Automattic/mongoose/issues/16291) [#​5411](https://redirect.github.com/Automattic/mongoose/issues/5411) - types: pass TLeanResultType into query for type narrowing support with lean() [#​16523](https://redirect.github.com/Automattic/mongoose/issues/16523) [#​16519](https://redirect.github.com/Automattic/mongoose/issues/16519) - docs(guide): use async/await instead of removed callbacks [#​16566](https://redirect.github.com/Automattic/mongoose/issues/16566) [joi-agent](https://redirect.github.com/joi-agent) - test: run TypeScript tests on typescript 5+7 with combinations of exactOptionalPropertyTypes, skipLibCheck, strict [#​16510](https://redirect.github.com/Automattic/mongoose/issues/16510) [#​16506](https://redirect.github.com/Automattic/mongoose/issues/16506) ### [`v9.10.4`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#9104--2026-10-02) [Compare Source](https://redirect.github.com/Automattic/mongoose/compare/9.10.3...9.10.4) \=================== - fix: handle MongoDB server 9.x returning collation: { locale: 'simple' } on all indexes [#​16557](https://redirect.github.com/Automattic/mongoose/issues/16557) - fix(populate): resolve dotted parent path when collecting deferred sub-populate children [#​16538](https://redirect.github.com/Automattic/mongoose/issues/16538) [jfits](https://redirect.github.com/jfits) - fix(array): compare dates by value in indexOf() so pull() removes them [#​16535](https://redirect.github.com/Automattic/mongoose/issues/16535) [giaBaoJS](https://redirect.github.com/giaBaoJS) - fix(map): register $set when Map#set() replaces an array [#​16540](https://redirect.github.com/Automattic/mongoose/issues/16540) [#​16539](https://redirect.github.com/Automattic/mongoose/issues/16539) [luantaraschi](https://redirect.github.com/luantaraschi) - fix(query): cast case and then expressions in $expr $switch branches [#​16534](https://redirect.github.com/Automattic/mongoose/issues/16534) [kwy404](https://redirect.github.com/kwy404) - docs(guide): fix read preference tag set example [#​16541](https://redirect.github.com/Automattic/mongoose/issues/16541) [NotAFlightRisk](https://redirect.github.com/NotAFlightRisk) ### [`v9.10.3`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#9103--2026-09-29) [Compare Source](https://redirect.github.com/Automattic/mongoose/compare/9.10.2...9.10.3) \=================== - fix(model): preserve unsaved documents after ordered bulkSave errors [#​16533](https://redirect.github.com/Automattic/mongoose/issues/16533) [#​16532](https://redirect.github.com/Automattic/mongoose/issues/16532) [IbrahimHafez1](https://redirect.github.com/IbrahimHafez1) - fix(model): don't mutate the caller's update object in bulkWrite updateMany [#​16526](https://redirect.github.com/Automattic/mongoose/issues/16526) [fadiroot](https://redirect.github.com/fadiroot) - fix(schema): run setters declared on the union path itself [#​16528](https://redirect.github.com/Automattic/mongoose/issues/16528) [giaBaoJS](https://redirect.github.com/giaBaoJS) - fix(collection): open collection if connection was already opened [#​16527](https://redirect.github.com/Automattic/mongoose/issues/16527) [#​16525](https://redirect.github.com/Automattic/mongoose/issues/16525) [#​16524](https://redirect.github.com/Automattic/mongoose/issues/16524) - fix(query+model): replace {MODEL} in cast error messages from update and bulkWrite casting [#​16529](https://redirect.github.com/Automattic/mongoose/issues/16529) [#​16502](https://redirect.github.com/Automattic/mongoose/issues/16502) [#​16480](https://redirect.github.com/Automattic/mongoose/issues/16480) ### [`v9.10.2`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#9102--2026-09-22) [Compare Source](https://redirect.github.com/Automattic/mongoose/compare/9.10.1...9.10.2) \=================== - fix(schema): drop subpaths and singleNestedPaths when a path is removed [#​16521](https://redirect.github.com/Automattic/mongoose/issues/16521) [#​16520](https://redirect.github.com/Automattic/mongoose/issues/16520) [luantaraschi](https://redirect.github.com/luantaraschi) - fix(schema): register path-level setters on Map paths [#​16518](https://redirect.github.com/Automattic/mongoose/issues/16518) [giaBaoJS](https://redirect.github.com/giaBaoJS) - fix(model): replace {MODEL} in castObject() cast error messages [#​16502](https://redirect.github.com/Automattic/mongoose/issues/16502) [#​16480](https://redirect.github.com/Automattic/mongoose/issues/16480) [dylanpulver](https://redirect.github.com/dylanpulver) - fix: preserve circular arrays when cloning with a seen map [#​16514](https://redirect.github.com/Automattic/mongoose/issues/16514) [Shubham-Padkonde](https://redirect.github.com/Shubham-Padkonde) - docs(async-await): fix broken link to Mongoose API docs [#​16517](https://redirect.github.com/Automattic/mongoose/issues/16517) [joshuablac](https://redirect.github.com/joshuablac) ### [`v9.10.1`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#9101--2026-09-14) [Compare Source](https://redirect.github.com/Automattic/mongoose/compare/9.10.0...9.10.1) \=================== - types: relax populate Model generics to allow typed virtuals to be passed to populate in TypeScript 7 with skipLibCheck [#​16503](https://redirect.github.com/Automattic/mongoose/issues/16503) ### [`v9.10.0`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#9100--2026-09-10) [Compare Source](https://redirect.github.com/Automattic/mongoose/compare/9.9.5...9.10.0) \=================== - feat: upgrade mongodb driver -> 7.6.0 - feat(model): add Model.findAndCount() wrapper for limit+skip based pagination with countDocuments [#​16460](https://redirect.github.com/Automattic/mongoose/issues/16460) [#​16454](https://redirect.github.com/Automattic/mongoose/issues/16454) - feat(schema): add Schema.prototype.queryHelper() to make it easier to define query helpers in TypeScript [#​16464](https://redirect.github.com/Automattic/mongoose/issues/16464) [#​16410](https://redirect.github.com/Automattic/mongoose/issues/16410) - feat: support middleware skip option for cursors and custom hooks [#​16350](https://redirect.github.com/Automattic/mongoose/issues/16350) [#​15883](https://redirect.github.com/Automattic/mongoose/issues/15883) [#​8768](https://redirect.github.com/Automattic/mongoose/issues/8768) [AbdelrahmanHafez](https://redirect.github.com/AbdelrahmanHafez) - fix: apply defaults to undefined array elements [#​16542](https://redirect.github.com/Automattic/mongoose/issues/16542) [#​9232](https://redirect.github.com/Automattic/mongoose/issues/9232) - types: support for type narrowing when using projection in find and findOne [#​16500](https://redirect.github.com/Automattic/mongoose/issues/16500) [#​15545](https://redirect.github.com/Automattic/mongoose/issues/15545) - types: make Schema.prototype.static() return type with new static [#​16464](https://redirect.github.com/Automattic/mongoose/issues/16464) ### [`v9.9.5`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#995--2026-09-04) [Compare Source](https://redirect.github.com/Automattic/mongoose/compare/9.9.4...9.9.5) \================== - fix(query): pass schema through when casting a nested $expr comparison [#​16496](https://redirect.github.com/Automattic/mongoose/issues/16496) [rajanpanth](https://redirect.github.com/rajanpanth) - fix(projection): build the dotted path correctly in isPathSelectedInclusive [#​16495](https://redirect.github.com/Automattic/mongoose/issues/16495) [rajanpanth](https://redirect.github.com/rajanpanth) - fix(document): replace {MODEL} in custom cast error messages from document validation [#​16480](https://redirect.github.com/Automattic/mongoose/issues/16480) [#​8300](https://redirect.github.com/Automattic/mongoose/issues/8300) [AbinMadathil-Celigo](https://redirect.github.com/AbinMadathil-Celigo) - types(model): add missing properties to listSearchIndexes() return type [#​16486](https://redirect.github.com/Automattic/mongoose/issues/16486) [lazerg](https://redirect.github.com/lazerg) ### [`v9.9.4`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#994--2026-08-25) [Compare Source](https://redirect.github.com/Automattic/mongoose/compare/9.9.3...9.9.4) \================== - fix(query): set strictQuery and strict on \_mongooseOptions consistently [#​16451](https://redirect.github.com/Automattic/mongoose/issues/16451) [#​16447](https://redirect.github.com/Automattic/mongoose/issues/16447) - fix(hydration): use the doc model for looking up a ref [#​16453](https://redirect.github.com/Automattic/mongoose/issues/16453) [rawmind](https://redirect.github.com/rawmind) - fix(schema): drop the map values subpath when removing a map path [#​16457](https://redirect.github.com/Automattic/mongoose/issues/16457) [rawmind](https://redirect.github.com/rawmind) - fix(schema): remove a map that lives under a nested path [#​16461](https://redirect.github.com/Automattic/mongoose/issues/16461) [#​16457](https://redirect.github.com/Automattic/mongoose/issues/16457) [luantaraschi](https://redirect.github.com/luantaraschi) - fix(schema): do not repeat null in a toJSONSchema enum that already lists null [#​16456](https://redirect.github.com/Automattic/mongoose/issues/16456) [luantaraschi](https://redirect.github.com/luantaraschi) - fix(schema): clone a document array element with its own constructor signature [#​16463](https://redirect.github.com/Automattic/mongoose/issues/16463) [#​16462](https://redirect.github.com/Automattic/mongoose/issues/16462) [luantaraschi](https://redirect.github.com/luantaraschi) - fix(schema): keep the map value schematype a single object when cloning [#​16473](https://redirect.github.com/Automattic/mongoose/issues/16473) [luantaraschi](https://redirect.github.com/luantaraschi) - fix(schema): clarify duplicate index warning to note index is not created [#​16476](https://redirect.github.com/Automattic/mongoose/issues/16476) [vjymisal0](https://redirect.github.com/vjymisal0) - perf(model): index bulkSave write errors by document id [#​16474](https://redirect.github.com/Automattic/mongoose/issues/16474) [yoominho91](https://redirect.github.com/yoominho91) - docs: add Atlas Vector Search and Atlas Search documentation [#​16395](https://redirect.github.com/Automattic/mongoose/issues/16395) - docs: fix dead MongoDB driver Collection link [#​16458](https://redirect.github.com/Automattic/mongoose/issues/16458) [rajanpanth](https://redirect.github.com/rajanpanth) ### [`v9.9.3`](https://redirect.github.com/Automattic/mongoose/blob/HEAD/CHANGELOG.md#993--2026-08-17) [Compare Source](https://redirect.github.com/Automattic/mongoose/compare/9.9.2...9.9.3) \================== - perf(document): cache projection metadata and avoid scanning all projected paths for flat projections [#​16439](https://redirect.github.com/Automattic/mongoose/issues/16439) [#​16407](https://redirect.github.com/Automattic/mongoose/issues/16407) [#​16373](https://redirect.github.com/Automattic/mongoose/issues/16373) [yogesh968](https://redirect.github.com/yogesh968) - fix(cast): reject arrays when casting to Int32 or Double [#​16446](https://redirect.github.com/Automattic/mongoose/issues/16446) [rajanpanth](https://redirect.github.com/rajanpanth) - docs: document new/returnOriginal deprecation from 9.2.0 [#​16449](https://redirect.github.com/Automattic/mongoose/issues/16449) [#​16008](https://redirect.github.com/Automattic/mongoose/issues/16008) [#​15972](https://redirect.github.com/Automattic/mongoose/issues/15972) [alimughal95](https://redirect.github.com/alimughal95) - docs(schematypes): clarify that array default applies to the level it is declared on [#​16441](https://redirect.github.com/Automattic/mongoose/issues/16441) [#​9232](https://redirect.github.com/Automattic/mongoose/issues/9232) </details> --- ### Configuration 📅 **Schedule**: (UTC) - Branch creation - At any time (no schedule defined) - Automerge - "after 9am and before 5pm Monday" 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about these updates again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/cerbos/query-plan-adapters). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0NC4yMjIuNSIsInVwZGF0ZWRJblZlciI6IjQ0LjIyOC4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119--> --------- Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Signed-off-by: Alex Olivier <alex@alexolivier.me> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Alex Olivier <alex@alexolivier.me>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Array.from(arguments)contributes a meaningful amount of overhead with no gain - modern JS supports...argswhich provides a real array, and there's no need to clone because mutating argument order does nothing. Repeated cloning over and over causes performance issues and doesn't help anything.@AbdelrahmanHafez @hasezoey please review