Refactoring day1
This commit is contained in:
13
node_modules/mongoose/lib/helpers/document/compile.js
generated
vendored
13
node_modules/mongoose/lib/helpers/document/compile.js
generated
vendored
@@ -124,13 +124,6 @@ function defineKey(prop, subprops, prototype, prefix, keys, options) {
|
||||
}
|
||||
});
|
||||
|
||||
Object.defineProperty(nested, '$__parent', {
|
||||
enumerable: false,
|
||||
configurable: true,
|
||||
writable: false,
|
||||
value: this
|
||||
});
|
||||
|
||||
compile(subprops, nested, path, options);
|
||||
this.$__.getters[path] = nested;
|
||||
}
|
||||
@@ -138,10 +131,8 @@ function defineKey(prop, subprops, prototype, prefix, keys, options) {
|
||||
return this.$__.getters[path];
|
||||
},
|
||||
set: function(v) {
|
||||
if (v != null && v.$__isNested) {
|
||||
// Convert top-level to POJO, but leave subdocs hydrated so `$set`
|
||||
// can handle them. See gh-9293.
|
||||
v = v.$__parent.get(path);
|
||||
if (v instanceof Document) {
|
||||
v = v.toObject({ transform: false });
|
||||
}
|
||||
const doc = this.$__[scopeSymbol] || this;
|
||||
doc.$set(path, v);
|
||||
|
||||
Reference in New Issue
Block a user