skip to Main Content

I’m being told I have an invalid connection string for my MongoDB data provider.

Specifically, I’m getting this: The provided database string is invalid. MongoDB connection string error: Missing delimiting slash between hosts and options in database URL.

My problem, however, is that my connection string does have a delimiting slash: it’s this: mongodb://<user>:<pass>@cluster0.<server>.mongodb.net/?retryWrites=true&w=majority

What’s going on? Is there anything I’m missing?

3

Answers


  1. It’s missing database name after host: mongodb://<user>:<pass>@cluster0.<server>.mongodb.net/<mydb>?retryWrites=true&w=majority

    Login or Signup to reply.
  2. If you are using mongodb then just write database name as the path (replace <name> etc.)

    mongodb://<user>:<pass>@cluster0.<server>.mongodb.net/<name>?retryWrites=true&w=majority
    
    Login or Signup to reply.
  3. For someone who tried to connect mongodb in prisma, maybe you choose wrong connect , try to use type connect using VSCode

    mongodb+srv://<admin>:<password>@cluster0.8hjts4c.mongodb.net/test 
    

    it must have /test

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search