Details
-
Task
-
Resolution: Done
-
Major - P3
-
None
-
None
-
None
Description
I am trying to come up with a C# code to add users to a mongodb database.
I have the below code, and need the password to be in a password hash format to insert it into system.users. Can you tell me if there any built-in function in c#, or any other price of code that I can use to convert a password into the hash format before inserting it into system.users?
var user = new MongoUser("foouser", new PasswordEvidence("foopassword"), true); var database = server.GetDatabase("admin"); var usersCollection = database.GetCollection("system.users");
var userDocument = new BsonDocument
{
,
,
,
{ "otherDBRoles", new BsonDocument("productDB", new BsonArray
) } }; usersCollection.Insert(userDocument);