Skip to content

Commit

Permalink
fix: gh-8798
Browse files Browse the repository at this point in the history
adding $__ in front of schema at line 1671 let all the toObject tests pass and fixed the maximum stack error
  • Loading branch information
IslandRhythms committed Jan 25, 2021
1 parent 25ba5f1 commit 2373c07
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/document.js
Original file line number Diff line number Diff line change
Expand Up @@ -1668,7 +1668,7 @@ Document.prototype.$__path = function(path) {
if (adhocType) {
return adhocType;
}
return this.schema.path(path);
return this.$__schema.path(path);
};

/**
Expand Down Expand Up @@ -3047,7 +3047,9 @@ Document.prototype.$__setSchema = function(schema) {
for (const key of Object.keys(schema.virtuals)) {
schema.virtuals[key]._applyDefaultGetters();
}
this.schema = schema;
if (schema.path('schema') == null) {
this.schema = schema;
}
this.$__schema = schema;
this[documentSchemaSymbol] = schema;
};
Expand Down

0 comments on commit 2373c07

Please sign in to comment.