Table of Contents

Method CreateCredential

Namespace
MongoDB.Driver
Assembly
MongoDB.Driver.dll

CreateCredential(string, string, string)

Creates a default credential.

public static MongoCredential CreateCredential(string databaseName, string username, string password)

Parameters

databaseName string

Name of the database.

username string

The username.

password string

The password.

Returns

MongoCredential

A default credential.

CreateCredential(string, string, SecureString)

Creates a default credential. Less secure when used in conjunction with SCRAM-SHA-256, due to the need to store the password in a managed string in order to SaslPrep it.

public static MongoCredential CreateCredential(string databaseName, string username, SecureString password)

Parameters

databaseName string

Name of the database.

username string

The username.

password SecureString

The password.

Returns

MongoCredential

A default credential.