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

Adapt to changed mongoose behaviour #73

Merged

Conversation

vinerich
Copy link
Collaborator

@vinerich vinerich commented Oct 4, 2020

Summary (Fixes #71)

  • Bumps mongoose to newest version
  • Adapts to mongoose changes

Explanation

Somewhere along the versions 5.9 to 5.10 several changes where introduced:

  • Plugin hook functions must (!) call next(), simply calling return while leave a non-returning promise.
  • When upserting a document the query result changed from { nModified: 1, ... } to { nModified: 0, upserted: [docs], ... }

So I changed the nModified check to include the new upserted property and am calling next() to return.

Additional

In #72 I tested my fix on different mongoose versions and it passed on both. I also tested with more versions on my machine.
However this tests are not included into CI. I'm not sure if running 30 different version combinations is a good way to go.

I would propose to include Node v14 in the test, but only run with the newest mongoose versions. Your opinion @codepunkt?

@vinerich
Copy link
Collaborator Author

@codepunkt Maybe consider merging this PR. Last bump, I promise 😄

@vinerich vinerich merged commit b9d8abd into codepunkt:master Jan 19, 2021
@vinerich vinerich deleted the adapt-to-changed-mongoose-behaviour branch January 19, 2021 11:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug: With the plugin, updateOne hangs, if nothing was found
1 participant