shuttle-hq / shuttle

Build & ship backends without writing any infrastructure files.
https://shuttle.rs
Apache License 2.0
6.1k stars 253 forks source link

[Improvement]: MongoDB database selected on local run #1792

Open tibs245 opened 5 months ago

tibs245 commented 5 months ago

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 :

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

joshua-mo-143 commented 5 months ago

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.

Aditya-PS-05 commented 1 day ago

@joshua-mo-143 , Please assign me this issue.