Versions in this module Expand all Collapse all v2 v2.3.0 Aug 13, 2025 v2.2.3 Aug 5, 2025 v2.2.2 Jun 5, 2025 v2.2.1 May 6, 2025 v2.2.0 Apr 9, 2025 v2.1.0 Feb 26, 2025 v2.0.1 Feb 20, 2025 v2.0.0 Dec 10, 2024 Changes in this version + const SchemeMongoDB + const SchemeMongoDBSRV + const ServerMonitoringModeAuto + const ServerMonitoringModePoll + const ServerMonitoringModeStream + var ErrLoadBalancedWithDirectConnection = errors.New(...) + var ErrLoadBalancedWithMultipleHosts = errors.New("loadBalanced cannot be set to true if multiple hosts are specified") + var ErrLoadBalancedWithReplicaSet = errors.New("loadBalanced cannot be set to true if a replica set name is specified") + var ErrSRVMaxHostsWithLoadBalanced = errors.New("srvMaxHosts cannot be a positive value if loadBalanced is set to true") + var ErrSRVMaxHostsWithReplicaSet = errors.New("srvMaxHosts cannot be a positive value if a replica set name is specified") + func IsValidServerMonitoringMode(mode string) bool + type ConnString struct + AppName string + AuthMechanism string + AuthMechanismProperties map[string]string + AuthMechanismPropertiesSet bool + AuthSource string + AuthSourceSet bool + Compressors []string + Connect ConnectMode + ConnectSet bool + ConnectTimeout time.Duration + ConnectTimeoutSet bool + Database string + DirectConnection bool + DirectConnectionSet bool + HeartbeatInterval time.Duration + HeartbeatIntervalSet bool + Hosts []string + J bool + JSet bool + LoadBalanced bool + LoadBalancedSet bool + LocalThreshold time.Duration + LocalThresholdSet bool + MaxConnIdleTime time.Duration + MaxConnIdleTimeSet bool + MaxConnecting uint64 + MaxConnectingSet bool + MaxPoolSize uint64 + MaxPoolSizeSet bool + MaxStaleness time.Duration + MaxStalenessSet bool + MinPoolSize uint64 + MinPoolSizeSet bool + Options map[string][]string + Original string + Password string + PasswordSet bool + RawHosts []string + ReadConcernLevel string + ReadPreference string + ReadPreferenceTagSets []map[string]string + ReplicaSet string + RetryReads bool + RetryReadsSet bool + RetryWrites bool + RetryWritesSet bool + SRVMaxHosts int + SRVServiceName string + SSL bool + SSLCaFile string + SSLCaFileSet bool + SSLCertificateFile string + SSLCertificateFileSet bool + SSLClientCertificateKeyFile string + SSLClientCertificateKeyFileSet bool + SSLClientCertificateKeyPassword func() string + SSLClientCertificateKeyPasswordSet bool + SSLDisableOCSPEndpointCheck bool + SSLDisableOCSPEndpointCheckSet bool + SSLInsecure bool + SSLInsecureSet bool + SSLPrivateKeyFile string + SSLPrivateKeyFileSet bool + SSLSet bool + Scheme string + ServerMonitoringMode string + ServerSelectionTimeout time.Duration + ServerSelectionTimeoutSet bool + SocketTimeout time.Duration + SocketTimeoutSet bool + Timeout time.Duration + TimeoutSet bool + UnknownOptions map[string][]string + Username string + UsernameSet bool + WNumber int + WNumberSet bool + WString string + ZlibLevel int + ZlibLevelSet bool + ZstdLevel int + ZstdLevelSet bool + func Parse(s string) (*ConnString, error) + func ParseAndValidate(s string) (*ConnString, error) + func (u *ConnString) HasAuthParameters() bool + func (u *ConnString) String() string + func (u *ConnString) Validate() error + type ConnectMode uint8 + const AutoConnect + const SingleConnect + func (c ConnectMode) String() string v2.0.0-beta2 Sep 18, 2024 v2.0.0-beta1 Jul 26, 2024 v2.0.0-alpha2 Jul 26, 2024 Other modules containing this package go.mongodb.org/mongo-driver