Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(document): allow populating deeply nested models as strings #11168

Merged
merged 10 commits into from
Jan 4, 2022
Next Next commit
test quick fix for splitPath is undefined
  • Loading branch information
AbdelrahmanHafez committed Nov 17, 2021
commit b41cd1e9d6a0047ca625104ecaae4b171b6612cd
7 changes: 6 additions & 1 deletion lib/document.js
Original file line number Diff line number Diff line change
Expand Up @@ -642,7 +642,12 @@ Document.prototype.$__buildDoc = function(obj, fields, skipId, exclude, hasInclu
}
}

const path = this.$__schema.paths[p].splitPath();
const path = (typeof this.$__schema.paths[p].splitPath) === 'function' && this.$__schema.paths[p].splitPath();
if (!path) {
console.log(this.$__schema.paths[p]);
continue;
}

const len = path.length;
const last = len - 1;
let curPath = '';
Expand Down