MongoDB Database (digitalOcean) to NextJS with prisma

Hello, I created a Cluster Database (with mongoDB) in digitalOcean then created a new database collection “exampleDB” . In the other side, nextJS project (with prisma) I put the url to connect to my Cluster Database.

So I have 2 cases, the first one, it’s ok and all data from my project NextJS are going to admin file (default file created when we create a cluster) but now I want to put my data from nextJS to a specific file, in exampleDB but it doesn’t work! :(

Case 1:


Case 2:


My trouble is with the DATABASE_URL, in the case 2, I have this error:

Error: P1013 The provided database string is invalid. An invalid argument was provided: connection string tls option must be a boolean in database URL. Please refer to the documentation in for constructing a correct connection string. In some cases, certain characters must be escaped. Please check the string for any illegal characters.

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Bobby Iliev
Site Moderator
Site Moderator badge
June 16, 2024


In MongoDB connection strings, the database name should be specified directly after the hostname, and query parameters (like tls) should be correctly formatted. Here’s how you can adjust your connection string for your specific database exampleDB:


Let me know how it goes!

- Bobby

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Featured on Community

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel