From b864c100ecc5686e141447dd4d78b4ba4d347a21 Mon Sep 17 00:00:00 2001 From: Sam Tolmay Date: Thu, 7 Dec 2023 16:14:10 +0200 Subject: [PATCH] fix: Fix MultiAppMongoDBAdapter for mongodb v6 driver. --- .changeset/old-chicken-ring.md | 5 +++++ .../MultiAppMongoDBAdapter.js | 15 ++++++--------- 2 files changed, 11 insertions(+), 9 deletions(-) create mode 100644 .changeset/old-chicken-ring.md diff --git a/.changeset/old-chicken-ring.md b/.changeset/old-chicken-ring.md new file mode 100644 index 0000000..ed9bb8b --- /dev/null +++ b/.changeset/old-chicken-ring.md @@ -0,0 +1,5 @@ +--- +'@lowdefy/community-plugin-mongodb': patch +--- + +Fix MultiAppMongoDBAdapter for mongodb v6 driver. diff --git a/plugins/community-plugin-mongodb/src/auth/adapters/MultiAppMongoDBAdapter/MultiAppMongoDBAdapter.js b/plugins/community-plugin-mongodb/src/auth/adapters/MultiAppMongoDBAdapter/MultiAppMongoDBAdapter.js index c7d9262..f17f884 100644 --- a/plugins/community-plugin-mongodb/src/auth/adapters/MultiAppMongoDBAdapter/MultiAppMongoDBAdapter.js +++ b/plugins/community-plugin-mongodb/src/auth/adapters/MultiAppMongoDBAdapter/MultiAppMongoDBAdapter.js @@ -73,7 +73,7 @@ function MultiAppMongoDBAdapter({ properties }) { }, async unlinkAccount(provider_providerAccountId) { - const { value: account } = await mongoClient + const account = await mongoClient .db() .collection(collectionNames.accounts) .findOneAndDelete(provider_providerAccountId); @@ -118,16 +118,13 @@ function MultiAppMongoDBAdapter({ properties }) { { $set: session }, { returnDocument: 'after' } ); - return from(result.value); + return from(result); }, async deleteSession(sessionToken) { - const { value: session } = await mongoClient - .db() - .collection(collectionNames.sessions) - .findOneAndDelete({ - sessionToken, - }); + const session = await mongoClient.db().collection(collectionNames.sessions).findOneAndDelete({ + sessionToken, + }); return from(session); }, @@ -137,7 +134,7 @@ function MultiAppMongoDBAdapter({ properties }) { }, async useVerificationToken(identifier_token) { - const { value: verificationToken } = await mongoClient + const verificationToken = await mongoClient .db() .collection(collectionNames.verificationTokens) .findOneAndDelete(identifier_token);