Skip to main content

Get database

Gets information about the database

Function GetDatabase(Val Connection, Val Base = Undefined) Export

ParameterCLI optionTypeRequiredDescription
Connection--dbcString, ArbitraryConnection or connection string
Base--dbStringDatabase name. Current database if not specified
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, Base, Login, Password, ConnectionParams);
Connection = OPI_MongoDB.CreateConnection(ConnectionString);

Base = "test_db";

Result = OPI_MongoDB.GetDatabase(Connection, Base);
oint mongodb GetDatabase \
--dbc "mongodb://bayselonarrend:12we3456!2154@127.0.0.1:27017/main?authSource=admin" \
--db "test_db"
Result
{
"result": true,
"data": {
"db": "test_db",
"collections": 0,
"views": 0,
"objects": 0,
"avgObjSize": 0,
"dataSize": 0,
"storageSize": 0,
"indexes": 0,
"indexSize": 0,
"totalSize": 0,
"scaleFactor": 1,
"fsUsedSize": 0,
"fsTotalSize": 0,
"ok": 1
}
}