Class WriteConcern
Represents a write concern.
public sealed class WriteConcern : IEquatable<WriteConcern>, IConvertibleToBsonDocument
- Inheritance
-
WriteConcern
- Implements
- Inherited Members
Constructors
WriteConcern(Optional<WValue>, Optional<TimeSpan?>, Optional<bool?>, Optional<bool?>)
Initializes a new instance of the WriteConcern class.
public WriteConcern(Optional<WriteConcern.WValue> w = default, Optional<TimeSpan?> wTimeout = default, Optional<bool?> fsync = default, Optional<bool?> journal = default)
Parameters
w
Optional<WriteConcern.WValue>The w value.
wTimeout
Optional<TimeSpan?>The wtimeout value.
fsync
Optional<bool?>The fsync value .
journal
Optional<bool?>The journal value.
WriteConcern(int, Optional<TimeSpan?>, Optional<bool?>, Optional<bool?>)
Initializes a new instance of the WriteConcern class.
public WriteConcern(int w, Optional<TimeSpan?> wTimeout = default, Optional<bool?> fsync = default, Optional<bool?> journal = default)
Parameters
w
intThe w value.
wTimeout
Optional<TimeSpan?>The wtimeout value.
fsync
Optional<bool?>The fsync value .
journal
Optional<bool?>The journal value.
WriteConcern(string, Optional<TimeSpan?>, Optional<bool?>, Optional<bool?>)
Initializes a new instance of the WriteConcern class.
public WriteConcern(string mode, Optional<TimeSpan?> wTimeout = default, Optional<bool?> fsync = default, Optional<bool?> journal = default)
Parameters
mode
stringThe mode.
wTimeout
Optional<TimeSpan?>The wtimeout value.
fsync
Optional<bool?>The fsync value .
journal
Optional<bool?>The journal value.
Properties
Acknowledged
Gets an instance of WriteConcern that represents an acknowledged write concern.
public static WriteConcern Acknowledged { get; }
Property Value
- WriteConcern
An instance of WriteConcern that represents an acknowledged write concern.
FSync
Gets the fsync value.
public bool? FSync { get; }
Property Value
- bool?
The fsync value.
IsAcknowledged
Gets a value indicating whether this instance is an acknowledged write concern.
public bool IsAcknowledged { get; }
Property Value
- bool
true
if this instance is an acknowledged write concern; otherwise,false
.
IsServerDefault
Gets a value indicating whether this write concern will use the default on the server.
public bool IsServerDefault { get; }
Property Value
- bool
true
if this instance is the default; otherwise,false
.
Journal
Gets the journal value.
public bool? Journal { get; }
Property Value
- bool?
The journal value.
Unacknowledged
Gets an instance of WriteConcern that represents an unacknowledged write concern.
public static WriteConcern Unacknowledged { get; }
Property Value
- WriteConcern
An instance of WriteConcern that represents an unacknowledged write concern.
W
Gets the w value.
public WriteConcern.WValue W { get; }
Property Value
- WriteConcern.WValue
The w value.
W1
Gets an instance of WriteConcern that represents a W1 write concern.
public static WriteConcern W1 { get; }
Property Value
- WriteConcern
An instance of WriteConcern that represents a W1 write concern.
W2
Gets an instance of WriteConcern that represents a W2 write concern.
public static WriteConcern W2 { get; }
Property Value
- WriteConcern
An instance of WriteConcern that represents a W2 write concern.
W3
Gets an instance of WriteConcern that represents a W3 write concern.
public static WriteConcern W3 { get; }
Property Value
- WriteConcern
An instance of WriteConcern that represents a W3 write concern.
WMajority
Gets an instance of WriteConcern that represents a majority write concern.
public static WriteConcern WMajority { get; }
Property Value
- WriteConcern
An instance of WriteConcern that represents a majority write concern.
WTimeout
Gets the wtimeout value.
public TimeSpan? WTimeout { get; }
Property Value
- TimeSpan?
The wtimeout value.
Methods
Equals(WriteConcern)
public bool Equals(WriteConcern other)
Parameters
other
WriteConcern
Returns
Equals(object)
public override bool Equals(object obj)
Parameters
obj
object
Returns
FromBsonDocument(BsonDocument)
Creates a write concern from a document.
public static WriteConcern FromBsonDocument(BsonDocument document)
Parameters
document
BsonDocumentThe document.
Returns
- WriteConcern
A write concern.
GetHashCode()
public override int GetHashCode()
Returns
ToBsonDocument()
Converts this write concern to a BsonDocument suitable to be sent to the server.
public BsonDocument ToBsonDocument()
Returns
- BsonDocument
A BsonDocument.
ToString()
public override string ToString()
Returns
With(Optional<WValue>, Optional<TimeSpan?>, Optional<bool?>, Optional<bool?>)
Returns a new instance of WriteConcern with some values changed.
public WriteConcern With(Optional<WriteConcern.WValue> w = default, Optional<TimeSpan?> wTimeout = default, Optional<bool?> fsync = default, Optional<bool?> journal = default)
Parameters
w
Optional<WriteConcern.WValue>The w value.
wTimeout
Optional<TimeSpan?>The wtimeout value.
fsync
Optional<bool?>The fsync value.
journal
Optional<bool?>The journal value.
Returns
- WriteConcern
A WriteConcern.
With(int, Optional<TimeSpan?>, Optional<bool?>, Optional<bool?>)
Returns a new instance of WriteConcern with some values changed.
public WriteConcern With(int w, Optional<TimeSpan?> wTimeout = default, Optional<bool?> fsync = default, Optional<bool?> journal = default)
Parameters
w
intThe w value.
wTimeout
Optional<TimeSpan?>The wtimeout value.
fsync
Optional<bool?>The fsync value.
journal
Optional<bool?>The journal value.
Returns
- WriteConcern
A WriteConcern.
With(string, Optional<TimeSpan?>, Optional<bool?>, Optional<bool?>)
Returns a new instance of WriteConcern with some values changed.
public WriteConcern With(string mode, Optional<TimeSpan?> wTimeout = default, Optional<bool?> fsync = default, Optional<bool?> journal = default)
Parameters
mode
stringThe mode.
wTimeout
Optional<TimeSpan?>The wtimeout value.
fsync
Optional<bool?>The fsync value.
journal
Optional<bool?>The journal value.
Returns
- WriteConcern
A WriteConcern.