Skip to content

Commit

Permalink
fix(document): make $getPopulatedDocs() return populated virtuals
Browse files Browse the repository at this point in the history
Fix #10148
  • Loading branch information
vkarpov15 committed Apr 29, 2021
1 parent 3791616 commit d8785f1
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/document.js
Original file line number Diff line number Diff line change
Expand Up @@ -3933,7 +3933,13 @@ Document.prototype.populate = function populate() {
* @instance
*/
Document.prototype.$getPopulatedDocs = function $getPopulatedDocs() {
const keys = (Object.keys(this.$__.populated));
let keys = [];
if (this.$__.populated != null) {
keys = keys.concat(Object.keys(this.$__.populated));
}
if (this.$$populatedVirtuals != null) {
keys = keys.concat(Object.keys(this.$$populatedVirtuals));
}
let result = [];
for (const key of keys) {
const value = this.get(key);
Expand Down

0 comments on commit d8785f1

Please sign in to comment.