Skip to content

Commit 62b7b9c

Browse files
committed
fix: avoid pulling non-schema paths from documents into nested paths
Re: #10449
1 parent 7dd2aaf commit 62b7b9c

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

lib/helpers/document/compile.js

+7-7
Original file line numberDiff line numberDiff line change
@@ -188,13 +188,7 @@ function getOwnPropertyDescriptors(object) {
188188
const result = {};
189189

190190
Object.getOwnPropertyNames(object).forEach(function(key) {
191-
result[key] = Object.getOwnPropertyDescriptor(object, key);
192-
// Assume these are schema paths, ignore them re: #5470
193-
if (result[key].get) {
194-
delete result[key];
195-
return;
196-
}
197-
result[key].enumerable = [
191+
const skip = [
198192
'isNew',
199193
'$__',
200194
'errors',
@@ -205,6 +199,12 @@ function getOwnPropertyDescriptors(object) {
205199
'__index',
206200
'$isDocumentArrayElement'
207201
].indexOf(key) === -1;
202+
if (skip) {
203+
return;
204+
}
205+
206+
result[key] = Object.getOwnPropertyDescriptor(object, key);
207+
result[key].enumerable = false;
208208
});
209209

210210
return result;

0 commit comments

Comments
 (0)