Informations
What is the current behavior?
We use Mongo Cloud Atlas with a database URI of the format: mongodb+srv://USER:[email protected]/PROJECTDB
.
Today we upgraded Strapi from 3.0.0-alpha.12.7 to 3.0.0-alpha.26.2. After doing so, Strapi no longer connected to the correct database (PROJECTDB
, as specified in the URI), and instead was connecting to and creating a database called strapi
.
To fix this, I have had modify our production database.json to explicitly specify a database name,
{
"defaultConnection": "default",
"connections": {
"default": {
"connector": "strapi-hook-mongoose",
"settings": {
"client": "mongo",
"uri": "mongodb+srv://USER:[email protected]/PROJECTDB",
"database": "PROJECTDB"
},
"options": {
"ssl": true
}
}
}
Steps to reproduce the problem
strapi
.What is the expected behavior?
I expect Strapi to use the database specified in the URI. As it previously worked this way, it seems highly likely to be a bug.
Suggested solutions
This is somewhat similar to closed issue https://github.com/strapi/strapi/issues/1474 in which connectionOptions were clobbering database uri params. Perhaps there is something to be learned from how that was solved.
@doublemarked short answer it wasn't, your best bet is to move to separate variables as no one has worked on repairing the URI option.
Your welcome to look at it and submit a PR, note it may be blocked by the beta though.
Hello @doublemarked !
Thank you for this feedback.
You can find here the documentation (in the tab MongoDB) how to use Strapi and MongoDB Atlas
馃摎https://strapi.io/documentation/3.x.x/guides/deployment.html#heroku
About using uri
or connection
key from database settings, we have other issues about this topic.
But I'm agree we have to make this configuration fully usable.
Hello @lauriejim - can you please link the "other issues on this topic" that remain open, so that I might track your progress on this?