Skip to main content

Get list of bases

Gets the list of databases

Function GetListOfBases(Val Connection) Export

ParameterCLI optionTypeRequiredDescription
Connection--dbcString, ArbitraryConnection or connection string

Returns: Map Of KeyAndValue - Operation result

1C:Enterprise/OneScript code example
    Address  = "127.0.0.1:1234";
Login = "bayselonarrend";
Password = "12we...";

ConnectionParams = New Structure("authSource", "admin");
ConnectionString = OPI_MongoDB.GenerateConnectionString(Address, , Login, Password, ConnectionParams);
Connection = OPI_MongoDB.CreateConnection(ConnectionString);

Result = OPI_MongoDB.GetListOfBases(Connection);
    oint mongodb GetListOfBases \
--dbc "mongodb://bayselonarrend:12we3456!2154@127.0.0.1:27017/?authSource=admin"
Result
{
"result": true,
"data": {
"databases": [
{
"name": "admin",
"sizeOnDisk": 262144,
"empty": false
},
{
"name": "config",
"sizeOnDisk": 61440,
"empty": false
},
{
"name": "local",
"sizeOnDisk": 81920,
"empty": false
},
{
"name": "main",
"sizeOnDisk": 40960,
"empty": false
},
{
"name": "openyellow",
"sizeOnDisk": 286720,
"empty": false
},
{
"name": "test_db",
"sizeOnDisk": 40960,
"empty": false
}
],
"totalSize": 774144,
"totalSizeMb": 0,
"ok": 1
}
}