Skip to content

Commit

Permalink
fix: patch for issue in mongo driver 4.x.x (#1209)
Browse files Browse the repository at this point in the history
  • Loading branch information
gezquinndesign authored Jan 17, 2022
1 parent 0a40221 commit 5fa570d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/fifty-pans-smash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@accounts/mongo-password': patch
---

If users are currently using the Node Mongo Driver v4/Mongoose v6 (both are designed for use with MongoDB 5), this patch ensures no errors thrown when using these methods.
4 changes: 2 additions & 2 deletions packages/database-mongo-password/src/mongo-password.ts
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ export class MongoServicePassword implements DatabaseInterfaceServicePassword {
},
}
);
if (ret.result.nModified === 0) {
if ((ret.modifiedCount && ret.modifiedCount === 0) || (ret.result && ret.result.nModified === 0)) {
throw new Error('User not found');
}
}
Expand All @@ -280,7 +280,7 @@ export class MongoServicePassword implements DatabaseInterfaceServicePassword {
},
}
);
if (ret.result.nModified === 0) {
if ((ret.modifiedCount && ret.modifiedCount === 0) || (ret.result && ret.result.nModified === 0)) {
throw new Error('User not found');
}
}
Expand Down

0 comments on commit 5fa570d

Please sign in to comment.