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
Currently, the driver has issues connecting to Atlas tiers above M2 unless the server version is at least 4.2. We're working on fixing this, but in the meantime, a workaround is to upgrade your cluster to 4.2. The driver has no known issues with either M0 or M2 instances.
184
186
187
+
## Windows DNS note
188
+
189
+
On Windows, there is a known issue in the `trust-dns-resolver` crate, which the driver uses to perform DNS lookups, that causes severe performance degradation in resolvers that use the system configuration. Since the driver uses the system configuration by default, users are recommended to specify an alternate resolver configuration on Windows until that issue is resolved. This only has an effect when connecting to deployments using a `mongodb+srv` connection string.
Copy file name to clipboardExpand all lines: src/client/options/mod.rs
+38-2Lines changed: 38 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -24,6 +24,7 @@ use rustls::{
24
24
};
25
25
use serde::Deserialize;
26
26
use strsim::jaro_winkler;
27
+
use trust_dns_resolver::config::ResolverConfig;
27
28
use typed_builder::TypedBuilder;
28
29
use webpki_roots::TLS_SERVER_ROOTS;
29
30
@@ -360,6 +361,15 @@ pub struct ClientOptions {
360
361
361
362
#[builder(default)]
362
363
pub(crate)original_uri:Option<String>,
364
+
365
+
/// Configuration of the trust-dns resolver used for SRV and TXT lookups.
366
+
/// By default, the host system's resolver configuration will be used.
367
+
///
368
+
/// On Windows, there is a known performance issue in trust-dns with using the default system
369
+
/// configuration, so a custom configuration is recommended.
370
+
#[builder(default)]
371
+
#[serde(skip)]
372
+
pub(crate)resolver_config:Option<ResolverConfig>,
363
373
}
364
374
365
375
fndefault_hosts() -> Vec<StreamAddress>{
@@ -574,6 +584,7 @@ impl From<ClientOptionsParser> for ClientOptions {
574
584
command_event_handler:None,
575
585
original_srv_hostname:None,
576
586
original_uri:Some(parser.original_uri),
587
+
resolver_config:None,
577
588
}
578
589
}
579
590
}
@@ -639,13 +650,38 @@ impl ClientOptions {
639
650
/// * `wTimeoutMS`: maps to the `w_timeout` field of the `write_concern` field
640
651
/// * `zlibCompressionLevel`: not yet implemented
641
652
pubasyncfnparse(s:&str) -> Result<Self>{
642
-
let parser = ClientOptionsParser::parse(s)?;
653
+
Self::parse_uri(s,None).await
654
+
}
655
+
656
+
/// Parses a MongoDB connection string into a `ClientOptions` struct.
657
+
/// If the string is malformed or one of the options has an invalid value, an error will be
658
+
/// returned.
659
+
///
660
+
/// In the case that "mongodb+srv" is used, SRV and TXT record lookups will be done using the
661
+
/// provided `ResolverConfig` as part of this method.
662
+
///
663
+
/// The format of a MongoDB connection string is described [here](https://docs.mongodb.com/manual/reference/connection-string/#connection-string-formats).
664
+
///
665
+
/// See the docstring on `ClientOptions::parse` for information on how the various URI options
666
+
/// map to fields on `ClientOptions`.
667
+
pubasyncfnparse_with_resolver_config(
668
+
uri:&str,
669
+
resolver_config:ResolverConfig,
670
+
) -> Result<Self>{
671
+
Self::parse_uri(uri,Some(resolver_config)).await
672
+
}
673
+
674
+
/// Populate this `ClientOptions` from the given URI, optionally using the resolver config for
0 commit comments