MongoDB Client: Connected or Not connected
Hello. I am using better-auth for the first time. I am using MongoDB as my database. Now, my questions is, should I pass a
connected MongoDB client or just a normal MongoClient, and better-auth will do the connection itself?
Here is my current code. It works so far. (Kindly ignore the Property 'db' does not exist on type '{ success: true; client: MongoClient; } | { success: false; } error mongodbAdapter(client.db()) I am in the midst of a refactor'.
5 Replies
i do
const db = client.db("auth"), and pass it to mongodbAdapterUmm does you client.db("auth") return a
connected MongoClient?
I am using NextJS too
Damn
Nice Singleton pattern
Is this MongoDB singleton working in production well?
Yea its from nextjs docs iirc