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

Document.populate & Document.execPopulate in a transaction #6754

Closed
sebastian-nowak opened this issue Jul 22, 2018 · 4 comments
Closed

Document.populate & Document.execPopulate in a transaction #6754

sebastian-nowak opened this issue Jul 22, 2018 · 4 comments
Labels
confirmed-bug We've confirmed this is a bug in Mongoose and will fix it. enhancement This issue is a user-facing general improvement that doesn't fix a bug or add a new feature
Milestone

Comments

@sebastian-nowak
Copy link

Docs for doc.$session() only mention that it applies save():

screen shot 2018-07-22 at 16 35 52

Does it mean that calling doc.populate() or doc.execPopulate will ignore the associated mongo session?

@vkarpov15
Copy link
Collaborator

Yes it will, we missed that. Thanks for pointing out this issue, we will fix ASAP 👍

@vkarpov15 vkarpov15 added this to the 5.2.6 milestone Jul 27, 2018
@vkarpov15 vkarpov15 added priority confirmed-bug We've confirmed this is a bug in Mongoose and will fix it. enhancement This issue is a user-facing general improvement that doesn't fix a bug or add a new feature labels Jul 27, 2018
vkarpov15 added a commit that referenced this issue Jul 27, 2018
@vkarpov15
Copy link
Collaborator

Fixed in master, will be released in 5.2.6 next Monday 👍

@sebastian-nowak
Copy link
Author

That's great, thank you @vkarpov15 🙂

Just noticed one thing:

     // Use `$session()` by default if the document has an associated session
     // See gh-6754
     if (this.$session() != null) {
       const session = this.$session();
       paths.forEach(path => {
         path.options = path.options || {};
         path.options.session = session;
       });
     }

It means that $session on a document takes precedence over session passed explicitly via options. Shouldn't it be the other way around?

@vkarpov15
Copy link
Collaborator

You're right, good catch, will fix 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
confirmed-bug We've confirmed this is a bug in Mongoose and will fix it. enhancement This issue is a user-facing general improvement that doesn't fix a bug or add a new feature
Projects
None yet
Development

No branches or pull requests

2 participants