Table of Contents

Class MongoUser

Namespace
MongoDB.Driver
Assembly
MongoDB.Driver.Legacy.dll

Represents a MongoDB user.

[Serializable]
[Obsolete("Use the new user management commands instead.")]
public class MongoUser : IEquatable<MongoUser>
Inheritance
MongoUser
Implements
Inherited Members
Extension Methods

Constructors

MongoUser(string, PasswordEvidence, bool)

Creates a new instance of MongoUser.

public MongoUser(string username, PasswordEvidence password, bool isReadOnly)

Parameters

username string

The username.

password PasswordEvidence

The password.

isReadOnly bool

Whether the user has read-only access.

MongoUser(string, string, bool)

Creates a new instance of MongoUser.

public MongoUser(string username, string passwordHash, bool isReadOnly)

Parameters

username string

The username.

passwordHash string

The password hash.

isReadOnly bool

Whether the user has read-only access.

Properties

IsReadOnly

Gets or sets a value indicating whether the user is a read-only user.

public bool IsReadOnly { get; set; }

Property Value

bool

PasswordHash

Gets or sets the password hash.

public string PasswordHash { get; set; }

Property Value

string

Username

Gets or sets the username.

public string Username { get; set; }

Property Value

string

Methods

Equals(MongoUser)

Determines whether this instance and another specified MongoUser object have the same value.

public bool Equals(MongoUser rhs)

Parameters

rhs MongoUser

The MongoUser 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(MongoUser, MongoUser)

Determines whether two specified MongoUser objects have the same value.

public static bool Equals(MongoUser lhs, MongoUser rhs)

Parameters

lhs MongoUser

The first value to compare, or null.

rhs MongoUser

The 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 MongoUser object, have the same value.

public override bool Equals(object obj)

Parameters

obj object

The MongoUser object to compare to this instance.

Returns

bool

True if obj is a MongoUser object and its value is the same as this instance; otherwise, false.

GetHashCode()

Returns the hash code for this Class1 object.

public override int GetHashCode()

Returns

int

A 32-bit signed integer hash code.

HashPassword(string, PasswordEvidence)

Calculates the password hash.

public static string HashPassword(string username, PasswordEvidence password)

Parameters

username string

The username.

password PasswordEvidence

The password.

Returns

string

The password hash.

HashPassword(string, string)

Calculates the password hash.

public static string HashPassword(string username, string password)

Parameters

username string

The username.

password string

The password.

Returns

string

The password hash.

ToString()

Returns a string representation of the user.

public override string ToString()

Returns

string

A string representation of the user.

Operators

operator ==(MongoUser, MongoUser)

Determines whether two specified MongoUser objects have the same value.

public static bool operator ==(MongoUser lhs, MongoUser rhs)

Parameters

lhs MongoUser

The first value to compare, or null.

rhs MongoUser

The 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 !=(MongoUser, MongoUser)

Determines whether two specified MongoUser objects have different values.

public static bool operator !=(MongoUser lhs, MongoUser rhs)

Parameters

lhs MongoUser

The first value to compare, or null.

rhs MongoUser

The second value to compare, or null.

Returns

bool

True if the value of lhs is different from the value of rhs; otherwise, false.