Reputation: 1
I have issue via connecting with database to my backend in mongodb compass database
I want to know what exactly the issue is there
MongooseError: The `uri` parameter to `openUri()` must be a string, got "undefined". Make sure the first parameter to `mongoose.connect()` or `mongoose.createConnection()` is a string.
at Connection.openUri (D:\Microservices\Grocery_Online_Shopping_App\online_shopping_monolithic\node_modules\mongoose\lib\connection.js:694:11)
MongooseError: The `uri` parameter to `openUri()` must be a string, got "undefined". Make sure the first parameter to `mongoose.connect()` or `mongoose.createConnection()` is a string.
at Connection.openUri (D:\Microservices\Grocery_Online_Shopping_App\online_shopping_monolithic\node_modules\mongoose\lib\connection.js:694:11)
connect()` or `mongoose.createConnection()` is a string.
Upvotes: -1
Views: 25
Reputation: 41
Pass the connection string to mongoose.connect(CONNECTION_STRING)
.
It is currently undefined, start by logging the value to the console.
If you're retrieving the connection string from environment variables, it's likely that the environment variables are not being loaded correctly.
Upvotes: 0