You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/client/options/mod.rs
+15-1Lines changed: 15 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -517,6 +517,12 @@ pub struct ClientOptions {
517
517
#[builder(default)]
518
518
pubserver_selection_timeout:Option<Duration>,
519
519
520
+
/// Default database for this client.
521
+
///
522
+
/// By default, no default database is specified.
523
+
#[builder(default)]
524
+
pubdefault_database:Option<String>,
525
+
520
526
#[builder(default, setter(skip))]
521
527
pub(crate)socket_timeout:Option<Duration>,
522
528
@@ -702,6 +708,7 @@ struct ClientOptionsParser {
702
708
pubzlib_compression:Option<i32>,
703
709
pubdirect_connection:Option<bool>,
704
710
pubcredential:Option<Credential>,
711
+
pubdefault_database:Option<String>,
705
712
max_staleness:Option<Duration>,
706
713
tls_insecure:Option<bool>,
707
714
auth_mechanism:Option<AuthMechanism>,
@@ -931,6 +938,7 @@ impl From<ClientOptionsParser> for ClientOptions {
931
938
retry_writes: parser.retry_writes,
932
939
socket_timeout: parser.socket_timeout,
933
940
direct_connection: parser.direct_connection,
941
+
default_database: parser.default_database,
934
942
driver_info:None,
935
943
credential: parser.credential,
936
944
cmap_event_handler:None,
@@ -969,6 +977,9 @@ impl ClientOptions {
969
977
///
970
978
/// The format of a MongoDB connection string is described [here](https://docs.mongodb.com/manual/reference/connection-string/#connection-string-formats).
971
979
///
980
+
/// Note that [default_database](ClientOptions::default_database) will be set from
981
+
/// `/defaultauthdb` in connection string.
982
+
///
972
983
/// The following options are supported in the options query string:
0 commit comments