MongoDBNoSQL
Last updated at 2023-09-03

MongoParseError: Invalid scheme, expected connection string to start with "mongodb://" or "mongodb+srv://”

ClickUp
Last Edit By
Last edited time
Sep 3, 2023 07:07 AM
Metatag
Slug
mongo-parse-error-invalid-scheme
AI Status
None
Published
Published
Date
Sep 3, 2023
Category
MongoDB
NoSQL
You may have experienced this when using MongoDB in your Javascript or Typescript project.
The cause may be different so I will write many solution. Please add yours too.

The #1 Solution

Remove the ; at the end of your environment variable line if it exists.
In my project, I just copied and pasted the value somewhere, and it apparently has ; at the end of the MONGODB_URI environment variable value like this:
MONGODB_URL="mongodb://<the rest of uri>"; <-- this ; is the cause

The #2 Solution

Please add comment for your solution to help other’s! 🙌

Is it the only solution?

Well, that’s what happened in my case. If you have another case and would like to share it with the community, please add a comment.
Thank you!
 

Discussion (0)

Related Posts