Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: auth db defaults #322

Closed
wants to merge 4 commits into from
Closed

Conversation

playerx
Copy link

@playerx playerx commented Dec 21, 2021

Current Behaviour:
authSource is changed when database name is passed in the connection string. The issue is in setting defaults, same connection string worked on nodejs official driver but didn't work with deno_mongo.

After Merge:
authSource will be changed only if authSource will be passed in the connection string, otherwise it will keep the default admin db as authSource

Related issue:
#319

@erfanium
Copy link
Member

erfanium commented Dec 21, 2021

this example from node's official driver is against this change:

import { MongoClient, ObjectId } from "mongodb";

const client = new MongoClient(
  "mongodb+srv://app:myapppass@cluster0.kaxqc.mongodb.net/dbName"
);
console.log(client.dbName);

Screenshot from 2021-12-21 14-09-30

@playerx
Copy link
Author

playerx commented Dec 21, 2021

I've just tried same connection string with nodejs mongodb:

mongodb+srv://USER:PASSWORD@jok-prod.RANDOM.mongodb.net/jok

And it connected to the jok database without specifying authSource (it used admin)

Maybe you are right and this change isn't correct, but than it means credentials.db shouldn't be used as authSource.

P.S. The main problem I want to fix is to use same connection string and make it work without setting authSource, always.

@playerx
Copy link
Author

playerx commented Dec 21, 2021

closing this PR and I'll continue checking what's the main issue

@playerx playerx closed this Dec 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants