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?
Summary (Fixes #71)
Explanation
Somewhere along the versions 5.9 to 5.10 several changes where introduced:
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?