Skip to content

Commit

Permalink
fix(document): handle overwriting $session in execPopulate()
Browse files Browse the repository at this point in the history
Re: #6754
  • Loading branch information
vkarpov15 committed Jul 29, 2018
1 parent f3af885 commit bc21555
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/document.js
Expand Up @@ -2771,8 +2771,13 @@ Document.prototype.populate = function populate() {
if (this.$session() != null) {
const session = this.$session();
paths.forEach(path => {
path.options = path.options || {};
path.options.session = session;
if (path.options == null) {
path.options = { session: session };
return;
}
if (!('session' in path.options)) {
path.options.session = session;
}
});
}

Expand Down

0 comments on commit bc21555

Please sign in to comment.