Skip to main content

Get database users

Gets information about all database users

Function GetDatabaseUsers(Val Connection, Val Base = Undefined, Val GetPassword = False, Val GetPrivileges = False) Export

ParameterCLI optionTypeRequiredDescription
Connection--dbcString, ArbitraryConnection or connection string
Base--dbStringDatabase name. Current database if not specified
GetPassword--spwdBooleanAdds user password hash to the returned data
GetPrivileges--sprvBooleanAdds a list of user privileges to the returned data
Returns

Map Of KeyAndValue - Operation result

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);

Result = OPI_MongoDB.GetDatabaseUsers(Connection, Base);
oint mongodb GetDatabaseUsers \
--dbc "mongodb://bayselonarrend:12we3456!2154@127.0.0.1:27017/?authSource=admin" \
--db "main"
Result
{
"result": true,
"data": {
"users": [
{
"_id": "main.newuser",
"userId": {
"__B64_BINARY__": "L8cl+NvyTamlIXmw6fkjeA=="
},
"user": "newuser",
"db": "main",
"roles": [
{
"role": "readWrite",
"db": "main"
}
],
"mechanisms": [
"SCRAM-SHA-1",
"SCRAM-SHA-256"
]
}
],
"ok": 1
}
}