Class MongoDBRef
Represents a DBRef (a convenient way to refer to a document).
[BsonSerializer(typeof(MongoDBRefSerializer))]
public class MongoDBRef : IEquatable<MongoDBRef>
- Inheritance
-
MongoDBRef
- Implements
- Inherited Members
Constructors
MongoDBRef(string, BsonValue)
Creates a MongoDBRef.
public MongoDBRef(string collectionName, BsonValue id)
Parameters
collectionNamestringThe name of the collection that contains the document.
idBsonValueThe Id of the document.
MongoDBRef(string, string, BsonValue)
Creates a MongoDBRef.
public MongoDBRef(string databaseName, string collectionName, BsonValue id)
Parameters
databaseNamestringThe name of the database that contains the document.
collectionNamestringThe name of the collection that contains the document.
idBsonValueThe Id of the document.
Properties
CollectionName
Gets the name of the collection that contains the document.
public string CollectionName { get; }
Property Value
DatabaseName
Gets the name of the database that contains the document.
public string DatabaseName { get; }
Property Value
Id
Gets the Id of the document.
public BsonValue Id { get; }
Property Value
Methods
Equals(MongoDBRef)
Determines whether this instance and another specified MongoDBRef object have the same value.
public bool Equals(MongoDBRef rhs)
Parameters
rhsMongoDBRefThe MongoDBRef object to compare to this instance.
Returns
- bool
True if the value of the rhs parameter is the same as this instance; otherwise, false.
Equals(MongoDBRef, MongoDBRef)
Determines whether two specified MongoDBRef objects have the same value.
public static bool Equals(MongoDBRef lhs, MongoDBRef rhs)
Parameters
lhsMongoDBRefThe first value to compare, or null.
rhsMongoDBRefThe second value to compare, or null.
Returns
- bool
True if the value of lhs is the same as the value of rhs; otherwise, false.
Equals(object)
Determines whether this instance and a specified object, which must also be a MongoDBRef object, have the same value.
public override bool Equals(object obj)
Parameters
objobjectThe MongoDBRef object to compare to this instance.
Returns
- bool
True if obj is a MongoDBRef object and its value is the same as this instance; otherwise, false.
GetHashCode()
Returns the hash code for this MongoDBRef object.
public override int GetHashCode()
Returns
- int
A 32-bit signed integer hash code.
ToString()
Returns a string representation of the value.
public override string ToString()
Returns
- string
A string representation of the value.
Operators
operator ==(MongoDBRef, MongoDBRef)
Determines whether two specified MongoDBRef objects have the same value.
public static bool operator ==(MongoDBRef lhs, MongoDBRef rhs)
Parameters
lhsMongoDBRefThe first value to compare, or null.
rhsMongoDBRefThe second value to compare, or null.
Returns
- bool
True if the value of lhs is the same as the value of rhs; otherwise, false.
operator !=(MongoDBRef, MongoDBRef)
Determines whether two specified MongoDBRef objects have different values.
public static bool operator !=(MongoDBRef lhs, MongoDBRef rhs)
Parameters
lhsMongoDBRefThe first value to compare, or null.
rhsMongoDBRefThe second value to compare, or null.
Returns
- bool
True if the value of lhs is different from the value of rhs; otherwise, false.