Class MongoClientSettings
The settings for a MongoDB client.
public class MongoClientSettings : IEquatable<MongoClientSettings>
- Inheritance
-
MongoClientSettings
- Implements
- Inherited Members
Constructors
MongoClientSettings()
Creates a new instance of MongoClientSettings. Usually you would use a connection string instead.
public MongoClientSettings()
Properties
AllowInsecureTls
Gets or sets whether to relax TLS constraints as much as possible. Setting this variable to true will also set SslSettings.CheckCertificateRevocation to false.
public bool AllowInsecureTls { get; set; }
Property Value
ApplicationName
Gets or sets the application name.
public string ApplicationName { get; set; }
Property Value
AutoEncryptionOptions
Gets or sets the auto encryption options.
public AutoEncryptionOptions AutoEncryptionOptions { get; set; }
Property Value
ClusterConfigurator
Gets or sets the cluster configurator.
public Action<ClusterBuilder> ClusterConfigurator { get; set; }
Property Value
Compressors
Gets or sets the compressors.
public IReadOnlyList<CompressorConfiguration> Compressors { get; set; }
Property Value
ConnectTimeout
Gets or sets the connect timeout.
public TimeSpan ConnectTimeout { get; set; }
Property Value
ConnectionMode
Gets or sets the connection mode.
[Obsolete("Use DirectConnection instead.")]
public ConnectionMode ConnectionMode { get; set; }
Property Value
ConnectionModeSwitch
Gets the connection mode switch.
[Obsolete("This property will be removed in a later release.")]
public ConnectionModeSwitch ConnectionModeSwitch { get; }
Property Value
Credential
Gets or sets the credential.
public MongoCredential Credential { get; set; }
Property Value
Credentials
Gets or sets the credentials.
[Obsolete("Use Credential instead. Using multiple credentials is deprecated.")]
public IEnumerable<MongoCredential> Credentials { get; set; }
Property Value
DirectConnection
Gets or sets the direct connection.
public bool? DirectConnection { get; set; }
Property Value
- bool?
GuidRepresentation
Gets or sets the representation to use for Guids.
[Obsolete("Configure serializers instead.")]
public GuidRepresentation GuidRepresentation { get; set; }
Property Value
HeartbeatInterval
Gets or sets the heartbeat interval.
public TimeSpan HeartbeatInterval { get; set; }
Property Value
HeartbeatTimeout
Gets or sets the heartbeat timeout.
public TimeSpan HeartbeatTimeout { get; set; }
Property Value
IPv6
Gets or sets a value indicating whether to use IPv6.
public bool IPv6 { get; set; }
Property Value
IsFrozen
Gets a value indicating whether the settings have been frozen to prevent further changes.
public bool IsFrozen { get; }
Property Value
LinqProvider
Gets or sets the LINQ provider.
public LinqProvider LinqProvider { get; set; }
Property Value
LoadBalanced
Gets or sets whether load balanced mode is used.
public bool LoadBalanced { get; set; }
Property Value
LocalThreshold
Gets or sets the local threshold.
public TimeSpan LocalThreshold { get; set; }
Property Value
LoggingSettings
Gets or sets the logging settings
public LoggingSettings LoggingSettings { get; set; }
Property Value
MaxConnecting
Gets or sets the maximum concurrently connecting connections.
public int MaxConnecting { get; set; }
Property Value
MaxConnectionIdleTime
Gets or sets the max connection idle time.
public TimeSpan MaxConnectionIdleTime { get; set; }
Property Value
MaxConnectionLifeTime
Gets or sets the max connection life time.
public TimeSpan MaxConnectionLifeTime { get; set; }
Property Value
MaxConnectionPoolSize
Gets or sets the max connection pool size.
public int MaxConnectionPoolSize { get; set; }
Property Value
MinConnectionPoolSize
Gets or sets the min connection pool size.
public int MinConnectionPoolSize { get; set; }
Property Value
ReadConcern
Gets or sets the read concern.
public ReadConcern ReadConcern { get; set; }
Property Value
ReadEncoding
Gets or sets the Read Encoding.
public UTF8Encoding ReadEncoding { get; set; }
Property Value
ReadPreference
Gets or sets the read preferences.
public ReadPreference ReadPreference { get; set; }
Property Value
ReplicaSetName
Gets or sets the name of the replica set.
public string ReplicaSetName { get; set; }
Property Value
RetryReads
Gets or sets whether to retry reads.
public bool RetryReads { get; set; }
Property Value
RetryWrites
Gets or sets whether to retry writes.
public bool RetryWrites { get; set; }
Property Value
- bool
The default value is
true
.
Scheme
Gets or sets the connection string scheme.
public ConnectionStringScheme Scheme { get; set; }
Property Value
SdamLogFilename
Gets or set the name of the SDAM log file. Null turns logging off. stdout will log to console.
[Obsolete("Use LoggerFactory instead.")]
public string SdamLogFilename { get; set; }
Property Value
Server
Gets or sets the address of the server (see also Servers if using more than one address).
public MongoServerAddress Server { get; set; }
Property Value
ServerApi
Gets or sets the server API.
public ServerApi ServerApi { get; set; }
Property Value
ServerSelectionTimeout
Gets or sets the server selection timeout.
public TimeSpan ServerSelectionTimeout { get; set; }
Property Value
Servers
Gets or sets the list of server addresses (see also Server if using only one address).
public IEnumerable<MongoServerAddress> Servers { get; set; }
Property Value
SocketTimeout
Gets or sets the socket timeout.
public TimeSpan SocketTimeout { get; set; }
Property Value
SrvMaxHosts
Limits the number of SRV records used to populate the seedlist during initial discovery, as well as the number of additional hosts that may be added during SRV polling.
public int SrvMaxHosts { get; set; }
Property Value
SslSettings
Gets or sets the SSL settings.
public SslSettings SslSettings { get; set; }
Property Value
UseSsl
Gets or sets a value indicating whether to use SSL.
[Obsolete("Use UseTls instead.")]
public bool UseSsl { get; set; }
Property Value
UseTls
Gets or sets a value indicating whether to use TLS.
public bool UseTls { get; set; }
Property Value
VerifySslCertificate
Gets or sets a value indicating whether to verify an SSL certificate.
[Obsolete("Use AllowInsecureTls instead.")]
public bool VerifySslCertificate { get; set; }
Property Value
WaitQueueSize
Gets or sets the wait queue size.
[Obsolete("This property will be removed in a later release.")]
public int WaitQueueSize { get; set; }
Property Value
WaitQueueTimeout
Gets or sets the wait queue timeout.
public TimeSpan WaitQueueTimeout { get; set; }
Property Value
WriteConcern
Gets or sets the WriteConcern to use.
public WriteConcern WriteConcern { get; set; }
Property Value
WriteEncoding
Gets or sets the Write Encoding.
public UTF8Encoding WriteEncoding { get; set; }
Property Value
Methods
Clone()
Creates a clone of the settings.
public MongoClientSettings Clone()
Returns
- MongoClientSettings
A clone of the settings.
Equals(MongoClientSettings)
Determines whether the specified MongoClientSettings is equal to this instance.
public bool Equals(MongoClientSettings obj)
Parameters
obj
MongoClientSettingsThe MongoClientSettings to compare with this instance.
Returns
- bool
true
if the specified MongoClientSettings is equal to this instance; otherwise,false
.
Equals(object)
Determines whether the specified object is equal to this instance.
public override bool Equals(object obj)
Parameters
Returns
Freeze()
Freezes the settings.
public MongoClientSettings Freeze()
Returns
- MongoClientSettings
The frozen settings.
FromConnectionString(string)
Gets a MongoClientSettings object intialized with values from a connection string.
public static MongoClientSettings FromConnectionString(string connectionString)
Parameters
connectionString
stringThe connection string.
Returns
- MongoClientSettings
A MongoClientSettings.
FromUrl(MongoUrl)
Gets a MongoClientSettings object intialized with values from a MongoURL.
public static MongoClientSettings FromUrl(MongoUrl url)
Parameters
url
MongoUrlThe MongoURL.
Returns
- MongoClientSettings
A MongoClientSettings.
FrozenCopy()
Returns a frozen copy of the settings.
public MongoClientSettings FrozenCopy()
Returns
- MongoClientSettings
A frozen copy of the settings.
GetHashCode()
Gets the hash code.
public override int GetHashCode()
Returns
- int
The hash code.
ToString()
Returns a string representation of the settings.
public override string ToString()
Returns
- string
A string representation of the settings.
Operators
operator ==(MongoClientSettings, MongoClientSettings)
Determines whether two MongoClientSettings instances are equal.
public static bool operator ==(MongoClientSettings lhs, MongoClientSettings rhs)
Parameters
lhs
MongoClientSettingsThe LHS.
rhs
MongoClientSettingsThe RHS.
Returns
- bool
true
if the left hand side is equal to the right hand side; otherwise,false
.
operator !=(MongoClientSettings, MongoClientSettings)
Determines whether two MongoClientSettings instances are not equal.
public static bool operator !=(MongoClientSettings lhs, MongoClientSettings rhs)
Parameters
lhs
MongoClientSettingsThe LHS.
rhs
MongoClientSettingsThe RHS.
Returns
- bool
true
if the left hand side is not equal to the right hand side; otherwise,false
.