euberdeveloper / mongoback

The most powerful npm module to export and make backups of your MongoDB
https://mongoback.euber.dev
GNU General Public License v3.0
8 stars 1 forks source link

AuthenticationDatabase not being used in connection string #22

Closed Daxcor69 closed 1 year ago

Daxcor69 commented 1 year ago

Here my code:

const options = {
  host: [
        { host: mongo1-dev.local, port: 27017 },
        { host: mongo2-dev.local, port: 27017 },
        { host: mongo3-dev.local, port: 27017 },
      ],
  replicaSetName: "rs0",
  srv: false,
  username: "backup",
  password: "backup",
  outDir: `./backup/${dateString}`,
  auhenticationDatabase: "found_dev",
  authenticationMechanism: "SCRAM-SHA-256",
  all: true,
};
    await mongoExport(options);

The process errors out with the following:

uri: 'mongodb://backup:backup@mongo1-dev.local:27017,mongo2-dev.local:27017,mongo3-dev.local:27017/?authMechanism=SCRAM-SHA-256',
    options: { replicaSet: 'rs0' },
    triggerError: MongoServerError: Authentication failed.

As you can see in the connection string there is no auth db spec in the uri.

Daxcor69 commented 1 year ago

nm spelling mistake in the authentication