Class MongoServerSettings
The settings used to access a MongoDB server.
public class MongoServerSettings : IEquatable<MongoServerSettings>
- Inheritance
-
MongoServerSettings
- Implements
- Inherited Members
- Extension Methods
Constructors
MongoServerSettings()
Creates a new instance of MongoServerSettings. Usually you would use a connection string instead.
public MongoServerSettings()
Properties
AddressFamily
Gets the AddressFamily for the IPEndPoint (derived from the IPv6 setting).
[Obsolete("Use IPv6 instead.")]
public AddressFamily AddressFamily { get; }
Property Value
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
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 ot sets DirectConnection.
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
LocalThreshold
Gets or sets the local threshold.
public TimeSpan LocalThreshold { 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
OperationTimeout
Gets or sets the operation timeout.
public TimeSpan OperationTimeout { 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 MongoClientSettings.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
ServerSelectionTimeout
Gets or sets the server selection timeout.
public TimeSpan ServerSelectionTimeout { get; set; }
Property Value
Exceptions
- InvalidOperationException
MongoServerSettings is frozen.
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
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 MongoServerSettings Clone()
Returns
- MongoServerSettings
A clone of the settings.
Equals(MongoServerSettings)
Determines whether the specified MongoServerSettings is equal to this instance.
public bool Equals(MongoServerSettings obj)
Parameters
obj
MongoServerSettingsThe MongoServerSettings to compare with this instance.
Returns
- bool
true
if the specified MongoServerSettings 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 MongoServerSettings Freeze()
Returns
- MongoServerSettings
The frozen settings.
FromClientSettings(MongoClientSettings)
Creates a new MongoServerSettings object from a MongoClientSettings object.
public static MongoServerSettings FromClientSettings(MongoClientSettings clientSettings)
Parameters
clientSettings
MongoClientSettingsThe MongoClientSettings.
Returns
- MongoServerSettings
A MongoServerSettings.
FromUrl(MongoUrl)
Gets a MongoServerSettings object intialized with values from a MongoUrl.
public static MongoServerSettings FromUrl(MongoUrl url)
Parameters
url
MongoUrlThe MongoUrl.
Returns
- MongoServerSettings
A MongoServerSettings.
FrozenCopy()
Returns a frozen copy of the settings.
public MongoServerSettings FrozenCopy()
Returns
- MongoServerSettings
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 ==(MongoServerSettings, MongoServerSettings)
Determines whether two MongoServerSettings instances are equal.
public static bool operator ==(MongoServerSettings lhs, MongoServerSettings rhs)
Parameters
lhs
MongoServerSettingsThe LHS.
rhs
MongoServerSettingsThe RHS.
Returns
- bool
true
if the left hand side is equal to the right hand side; otherwise,false
.
operator !=(MongoServerSettings, MongoServerSettings)
Determines whether two MongoServerSettings instances are not equal.
public static bool operator !=(MongoServerSettings lhs, MongoServerSettings rhs)
Parameters
lhs
MongoServerSettingsThe LHS.
rhs
MongoServerSettingsThe RHS.
Returns
- bool
true
if the left hand side is not equal to the right hand side; otherwise,false
.