Add MongoDB client promise for usage in Auth providers #7757
hdodov
started this conversation in
Feature Requests & Ideas
Replies: 1 comment 1 reply
-
We have this for the postres and sqlite adapters. You could make a PR to add it to mongodb. It is named In the db type we have: The adapters set it up in
In connect, we call it: and destroy resets it:
|
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm using Payload
3.0.0-beta.84
with Auth.js and its MongoDB adapter to persist the sessions in the database.The problem is that I have to provide the connected MongoDB client (or a promise for it) to Auth.js and Payload doesn't provide it. This means I have to do nasty workarounds with exporting promises:
src/payload.config.ts
src/auth.ts
src/db.ts
What I tried
If I try this straight away:
…I get the following error:
…so the
db
object is not available yet.Ideal solution
If Payload has a promise that resolves when the MongoDB client is available, I could simply do:
Beta Was this translation helpful? Give feedback.
All reactions