-
Notifications
You must be signed in to change notification settings - Fork 153
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
RUST-1048 support something like get_default_database from client? #475
Comments
Hi @WindSoilder, thanks for the suggestion! Could you provide an example use case for this? For some context, in drivers (as opposed to the shell), the default database isn't used for much besides being the default auth source for certain auth mechanisms (e.g. SCRAM-SHA-256). |
It's mainly used for application config or cli arguments. Let's take mongodump as example, we can use mongodump like this: mongodump --uri="mongodb://mongodb0.example.com:27017/test_db" To dump only test_db, if we don't have the feature to get default datbaase, we have to use it like this: mongodump --uri="mongodb://mongodb0.example.com:27017/" --db test_db which is more complicated than the first one. For application involves more database instance, we can just use many urls for each mongodb instance, rather than specific every database explicitly |
Makes sense, I filed RUST-1048 to discuss with the team at our triage meeting on Monday. Thanks again for filing this issue! |
After discussing with the team, we agree that this would be a useful feature to have. We're not sure when we'll be able to get around to implementing it, but we'd be happy to accept a pull request if you were interesting in contributing it! We think the API changes would include the following:
Let me know if you have any other questions! |
Let's say that I have the following code:
It's good that we can fetch default database like this:
If I have the following code:
then
cli.get_default_database
can return None.Connection string reference: https://docs.mongodb.com/manual/reference/connection-string/
The text was updated successfully, but these errors were encountered: