Skip to main content

Execute command

Executes the command according to its description

Function ExecuteCommand(Val Connection, Val Command, Val Argument = 1, Val Base = Undefined, Val Data = Undefined) Export

ParameterCLI optionTypeRequiredDescription
Connection--dbcString, ArbitraryConnection or connection string
Command--commStringCommand name to execute
Argument--argArbitraryCommand argument
Base--dbStringDatabase in which the operation needs to be performed
Data--dataStructure Of KeyAndValueMain data fields for performing the operation
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);

Command = "listDatabases";
Data = New Structure("nameOnly", True);

Connection = OPI_MongoDB.CreateConnection(ConnectionString);

Result = OPI_MongoDB.ExecuteCommand(Connection, Command, , , Data);
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
}
}