Update user
Modifies existing user data
- Parameters
- Advanced call ?
Function UpdateUser(Val Connection, Val Name, Val UserRoles = Undefined, Val Base = Undefined, Val Password = Undefined, Val Parameters = Undefined) Export
| Parameter | CLI option | Type | Required | Description |
|---|---|---|---|---|
| Connection | --dbc | String, Arbitrary | ✔ | Connection or connection string |
| Name | --name | String | ✔ | Users name |
| UserRoles | --roles | Array Of Arbitrary | ✖ | Array of roles as strings or structures specifying the DB |
| Base | --db | String | ✖ | Database name. Current database if not specified |
| Password | --pwd | String | ✖ | Users password |
| Parameters | --params | Structure Of KeyAndValue | ✖ | Additional parameters |
Returns
Map Of KeyAndValue - Operation result
| Parameter | Description |
|---|---|
| addin_mode | Manual selection of external component connection mode (for 1C): Isolated, NotIsolated |
| dontwait | Creates a background job and returns its data (for 1C and OneScript only) |
tip
The passed roles completely replace the user's role list
Role can be defined in one of the following formats:
Structure: { role: "name", db: "database" }
String: role name
1C:Enterprise/OneScript code example
Address = "127.0.0.1:1234";
Login = "bayselonarrend";
Password = "12we...";
Base = "main";
ConnectionParams = New Structure("authSource", "admin");
ConnectionString = OPI_MongoDB.GenerateConnectionString(Address, , Login, Password, ConnectionParams);
Connection = OPI_MongoDB.CreateConnection(ConnectionString);
RoleArray = New Array;
RoleArray.Add("readWrite");
UserName = "newuser";
UserPassword = "4321";
Result = OPI_MongoDB.UpdateUser(Connection, UserName, RoleArray, Base, UserPassword);
- Bash
- CMD/Bat
oint mongodb UpdateUser \
--dbc "mongodb://bayselonarrend:12we3456!2154@127.0.0.1:27017/?authSource=admin" \
--name "anotheruser" \
--roles "['readWrite']" \
--db "main" \
--pwd "4321"
oint mongodb UpdateUser ^
--dbc "mongodb://bayselonarrend:12we3456!2154@127.0.0.1:27017/?authSource=admin" ^
--name "anotheruser" ^
--roles "['readWrite']" ^
--db "main" ^
--pwd "4321"
Result
{
"result": true,
"data": {
"ok": 1
}
}