[Improvement]: MongoDB database selected on local run
tibs245 opened this issue · 2 comments
Describe the improvement
Hello,
I test mongodb shared databases and if I understand correctly we have an error.
The databases selected on local-run is alway "admin". Or admin is a reserved databases for mongodb.
mongodb://mongodb:password@localhost:16352/admin
I see on the code :
provisioner/tests/helpers.rs
/// Execute commands in `mongosh` via `docker exec` against the provided `database_name`
/// or against the `admin` database by default
pub fn exec_mongosh(command: &str, database_name: Option<&str>) -> String {
let output = Command::new("docker")
.args([
"exec",
MONGODB_CONTAINER_NAME,
"mongosh",
"--quiet",
"--username",
"mongodb",
"--password",
"password",
"--authenticationDatabase",
"admin",
database_name.unwrap_or("admin"),
"--eval",
command,
])
.output()
.unwrap()
.stdout;
String::from_utf8(output).unwrap().trim().to_string()
}
I suppose it's for local run.
And for shuttle side :
provisioner/src/lib.rs
shared::Engine::Mongodb(_) => {
let database_name = format!("mongodb-{project_name}");
If it's possible to confirm to me it's not the behaviour we want.
And say to me what is the fix you want :
-
Create
mongodb-{project_name}
database for be exactly like the production mode- We can create specific user with right ?
- I don't known if we need test (and behaviour) when we run two shuttle instance with mongodb shared db
-
Or only create a static database
shuttle-local
to have empty database not use by mongodb system ?
I am interested to do the PR. I am not very experimented on Rust but I can do it with help (I am on shuttle discord) 😉
Thank you
Duplicate declaration
- I have searched the issues and this improvement has not been requested before.
Hi! We're currently in the process of actually deprecating our MongoDB addon. We're planning to add some replacements in lieu of it and will release an update when we are able to do so.