mongoose 8.24.10 → 8.24.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/document.js CHANGED
@@ -1769,8 +1769,11 @@ Document.prototype.$__set = function(pathToMark, path, options, constructing, pa
1769
1769
  let value = isMap ? obj.get(parts[i]) : obj[parts[i]];
1770
1770
  // Skip inherited properties like `Object.prototype.toString`, document methods,
1771
1771
  // or document internals like `$__schema` to avoid setting properties on shared
1772
- // objects. Document properties are getters on the prototype, so check `_doc`.
1773
- if (!isMap && !Object.hasOwn(obj.$__ == null ? obj : obj._doc, parts[i]) && parts[i] in obj) {
1772
+ // objects. Document properties are getters on the prototype, so read raw values
1773
+ // from `_doc`. Nested properties have a `$__` but their `_doc` is their parent's
1774
+ // `_doc`.
1775
+ const raw = obj.$__ != null && !obj.$__isNested ? obj._doc : obj;
1776
+ if (!isMap && !Object.hasOwn(raw, parts[i]) && parts[i] in obj) {
1774
1777
  return;
1775
1778
  }
1776
1779
  if (utils.isPOJO(value)) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mongoose",
3
3
  "description": "Mongoose MongoDB ODM",
4
- "version": "8.24.10",
4
+ "version": "8.24.11",
5
5
  "author": "Guillermo Rauch <guillermo@learnboost.com>",
6
6
  "keywords": [
7
7
  "mongodb",