1
0
mirror of https://github.com/Bayselonarrend/OpenIntegrations.git synced 2026-06-09 23:56:48 +02:00
Files
Vitaly the Alpaca (bot) bba99fc7d4 Main build (Jenkins)
2026-05-27 00:12:50 +03:00

113 lines
3.2 KiB
Plaintext
Vendored

---
sidebar_position: 5
description: Execute command and other functions to work with MongoDB in the Open Integration Package, a free open-source integration library for 1C:Enterprise 8, OneScript and CLI
keywords: [1C, 1С, 1С:Enterprise, 1С:Enterprise 8.3, API, Integration, Services, Exchange, OneScript, CLI, MongoDB]
---
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
import Admonition from '@theme/Admonition';
# Execute command
Executes the command according to its description
<Tabs>
<TabItem value="params" label="Parameters" default>
`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 | &#x2714; | Connection or connection string |
| Command | --comm | String | &#x2714; | Command name to execute |
| Argument | --arg | Arbitrary | &#x2716; | Command argument |
| Base | --db | String | &#x2716; | Database in which the operation needs to be performed |
| Data | --data | Structure Of KeyAndValue | &#x2716; | Main data fields for performing the operation |
<div className="return-value-note">
<div className="return-value-note__title">Returns</div>
<div className="return-value-note__value">
Map Of KeyAndValue - Operation result
</div>
</div>
</TabItem>
<TabItem value="extended" label={<span>Advanced call{' '}<a href="/docs/Start/Advanced-call" target="_blank" rel="noreferrer" title="About advanced call" onClick={(e) => e.stopPropagation()}>?</a></span>}>
| 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) |
</TabItem>
</Tabs>
```bsl title="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);
```
<Tabs>
<TabItem value="bash" label="Bash" default>
```bash
oint mongodb ExecuteCommand \
--dbc "mongodb://bayselonarrend:12we3456!2154@127.0.0.1:27017/?authSource=admin" \
--comm "listDatabases" \
--data "/tmp/t4qow4nl.ioj.json"
```
</TabItem>
<TabItem value="bat" label="CMD/Bat" default>
```batch
oint mongodb ExecuteCommand ^
--dbc "mongodb://bayselonarrend:12we3456!2154@127.0.0.1:27017/?authSource=admin" ^
--comm "listDatabases" ^
--data "/tmp/t4qow4nl.ioj.json"
```
</TabItem>
</Tabs>
```json title="Result"
{
"result": true,
"data": {
"databases": [
{
"name": "admin"
},
{
"name": "config"
},
{
"name": "local"
},
{
"name": "main"
}
],
"ok": 1
}
}
```