0

I'm following this short guide on how to use the MongoDB Adaptor with NextAuth.js. It sort of works. After I install it like so:

import clientPromise from "../../../lib/mongodb"

export const authOptions: NextAuthOptions = {
  adapter: MongoDBAdapter(clientPromise),
  ...
}

I am able to see user data in MongoDB Atlas! Hurray!

enter image description here

enter image description here

But as you can see, the name of the database is called "test". :(

Instead, I would like it to use the database I have configured for it. (That database also has the rest of my application's data.)

My .env.local

MONGODB_URI=mongodb://localhost:27117
DB_NAME=my-app-db

My question is, how do I get the MongoDB Adaptor of NextAuth.js to use a specific database name?

a53-416
  • 3,585
  • 6
  • 34
  • 44
  • Does this answer your question https://stackoverflow.com/questions/63224330/where-do-i-find-my-dbname-for-mongodb-connection-string – Kiran k Sep 09 '22 at 06:24
  • Yes, I guess i need a way to name my database, but my uri doesn't have a name in it. My ur is localhost, so it doesn't have much. I guess it's fine the name being test while in dev anyway.... – a53-416 Sep 12 '22 at 19:12

0 Answers0