Execute command
Executes the command according to its description
- Parameters
- Advanced call ?
Function ExecuteCommand(Val Connection, Val Command, Val Argument = 1, Val Base = Undefined, Val Data = Undefined) Export
| Parameter | CLI option | Type | Required | Description |
|---|---|---|---|---|
| Connection | --dbc | String, Arbitrary | ✔ | Connection or connection string |
| Command | --comm | String | ✔ | Command name to execute |
| Argument | --arg | Arbitrary | ✖ | Command argument |
| Base | --db | String | ✖ | Database in which the operation needs to be performed |
| Data | --data | Structure Of KeyAndValue | ✖ | Main data fields for performing the operation |
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...";
ConnectionParams = New Structure("authSource", "admin");
ConnectionString = OPI_MongoDB.GenerateConnectionString(Address, , Login, Password, ConnectionParams);
Command = "listDatabases";
Data = New Structure("nameOnly", True);
Connection = OPI_MongoDB.CreateConnection(ConnectionString);
Result = OPI_MongoDB.ExecuteCommand(Connection, Command, , , Data);
- Bash
- CMD/Bat
oint mongodb ExecuteCommand \
--dbc "mongodb://bayselonarrend:12we3456!2154@127.0.0.1:27017/?authSource=admin" \
--comm "listDatabases" \
--data "/tmp/t4qow4nl.ioj.json"
oint mongodb ExecuteCommand ^
--dbc "mongodb://bayselonarrend:12we3456!2154@127.0.0.1:27017/?authSource=admin" ^
--comm "listDatabases" ^
--data "/tmp/t4qow4nl.ioj.json"
Result
{
"result": true,
"data": {
"databases": [
{
"name": "admin"
},
{
"name": "config"
},
{
"name": "local"
},
{
"name": "main"
}
],
"ok": 1
}
}