Get database
Gets information about the database
- Parameters
- Advanced call ?
Function GetDatabase(Val Connection, Val Base = Undefined) Export
| Parameter | CLI option | Type | Required | Description |
|---|---|---|---|---|
| Connection | --dbc | String, Arbitrary | ✔ | Connection or connection string |
| Base | --db | String | ✖ | Database name. Current database if not specified |
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) |
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);
- Bash
- CMD/Bat
oint mongodb GetDatabase \
--dbc "mongodb://bayselonarrend:12we3456!2154@127.0.0.1:27017/main?authSource=admin" \
--db "test_db"
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
}
}