Table of Contents

Class TopologyVersion

Namespace
MongoDB.Driver.Core.Servers
Assembly
MongoDB.Driver.Core.dll

Represents a topology description.

public sealed class TopologyVersion : IEquatable<TopologyVersion>, IConvertibleToBsonDocument
Inheritance
TopologyVersion
Implements
Inherited Members

Remarks

Comparing topology descriptions freshness does not exhibit the reversal property of inequalities e.g. IsStalerThan(a, b) (a "<" b) does not imply !IsStalerThan(b, a) (b ">" a) See CompareTopologyVersion(TopologyVersion, TopologyVersion) for more information.

Constructors

TopologyVersion(ObjectId, long)

Initializes a new instance of the TopologyVersion class.

public TopologyVersion(ObjectId processId, long counter)

Parameters

processId ObjectId

The process identifier.

counter long

The counter.

Properties

Counter

Gets the process identifier.

public long Counter { get; }

Property Value

long

The process identifier.

ProcessId

Gets the process identifier.

public ObjectId ProcessId { get; }

Property Value

ObjectId

The process identifier.

Methods

CompareTopologyVersion(TopologyVersion, TopologyVersion)

Compares a local TopologyVersion with a server's TopologyVersion and indicates whether the local TopologyVersion is staler, fresher, or equal to the server's TopologyVersion. Per the SDAM specification, if the ProcessIds are not equal, this method assumes that y is more recent. This means that this method does not exhibit the reversal properties of inequalities i.e. a "<" b does not imply b ">" a.

public static int CompareTopologyVersion(TopologyVersion x, TopologyVersion y)

Parameters

x TopologyVersion

The first TopologyVersion.

y TopologyVersion

The other TopologyVersion.

Returns

int

Less than zero indicates that the x is staler than the y. Zero indicates that the x description is equal to the y. Greater than zero indicates that the x is fresher than the y.

Equals(TopologyVersion)

public bool Equals(TopologyVersion other)

Parameters

other TopologyVersion

Returns

bool

Equals(object)

public override bool Equals(object obj)

Parameters

obj object

Returns

bool

FromBsonDocument(BsonDocument)

Attempts to create a TopologyVersion from the supplied BsonDocument.

public static TopologyVersion FromBsonDocument(BsonDocument document)

Parameters

document BsonDocument

The document. Should contain an ObjectId named "processId" and a BsonInt64 named "counter".

Returns

TopologyVersion

A TopologyVersion if one could be constructed from the supplied document and null otherwise.

GetHashCode()

public override int GetHashCode()

Returns

int

IsFresherThan(TopologyVersion, TopologyVersion)

Gets whether or not x is fresher than y. Comparing topology descriptions freshness does not exhibit the reversal property of inequalities e.g. a.IsFresherThan(b) (a "<" b) does not imply !b.IsFresherThan(a) (b ">" a) See CompareTopologyVersion(TopologyVersion, TopologyVersion) for more information. In the case that this.Equals(y), y will be considered to be fresher.

public static bool IsFresherThan(TopologyVersion x, TopologyVersion y)

Parameters

x TopologyVersion

The first TopologyVersion.

y TopologyVersion

The other TopologyVersion.

Returns

bool

Whether or not this TopologyVersion is fresher than y.

IsFresherThanOrEqualTo(TopologyVersion, TopologyVersion)

Gets whether or not x is fresher than or Equal to y. Comparing topology descriptions freshness does not exhibit the reversal property of inequalities e.g. a.IsFresherThan(b) (a "<" b) does not imply !b.IsFresherThan(a) (b ">" a) See CompareTopologyVersion(TopologyVersion, TopologyVersion) for more information. In the case that this.Equals(y), y will be considered to be fresher.

public static bool IsFresherThanOrEqualTo(TopologyVersion x, TopologyVersion y)

Parameters

x TopologyVersion

The first TopologyVersion.

y TopologyVersion

The other TopologyVersion.

Returns

bool

Whether or not this TopologyVersion is fresher than y.

IsStalerThan(TopologyVersion, TopologyVersion)

Gets whether or not x is staler than or Equal to y. Comparing topology descriptions freshness does not exhibit the reversal property of inequalities e.g. a.IsStalerThan(b) (a "<" b) does not imply !b.IsStalerThan(a) (b ">" a). See CompareTopologyVersion(TopologyVersion, TopologyVersion) for more information. In the case that this == y, y will be considered to be fresher.

public static bool IsStalerThan(TopologyVersion x, TopologyVersion y)

Parameters

x TopologyVersion

The first TopologyVersion.

y TopologyVersion

The other TopologyVersion.

Returns

bool

Whether or not this TopologyVersion is staler than y.

IsStalerThanOrEqualTo(TopologyVersion, TopologyVersion)

Gets whether or not x is staler than or Equal to y. Comparing topology descriptions freshness does not exhibit the reversal property of inequalities e.g. a.IsStalerThan(b) (a "<" b) does not imply !b.IsStalerThan(a) (b ">" a). See CompareTopologyVersion(TopologyVersion, TopologyVersion) for more information. In the case that this == y, y will be considered to be fresher.

public static bool IsStalerThanOrEqualTo(TopologyVersion x, TopologyVersion y)

Parameters

x TopologyVersion

The first TopologyVersion.

y TopologyVersion

The other TopologyVersion.

Returns

bool

Whether or not this TopologyVersion is staler than y.

ToBsonDocument()

Converts this object to a BsonDocument.

public BsonDocument ToBsonDocument()

Returns

BsonDocument

A BsonDocument.

ToString()

public override string ToString()

Returns

string