1
0
mirror of https://github.com/Bayselonarrend/OpenIntegrations.git synced 2025-11-27 22:18:36 +02:00
Files
OpenIntegrations/docs/en/md/MongoDB/Common-methods/Generate-connection-string.mdx
Vitaly the Alpaca (bot) 806ba80a6d Main build (Jenkins)
2025-11-04 21:08:54 +03:00

46 lines
1.5 KiB
Plaintext
Vendored

---
sidebar_position: 4
description: Generate connection string 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';
# Generate connection string
Forms a MongoDB connection string
`Function GenerateConnectionString(Val Address, Val Base = "", Val Login = "", Val Password = "", Val Parameters = Undefined) Export`
| Parameter | CLI option | Type | Required | Description |
|-|-|-|-|-|
| Address | --addr | String | ✔ | Host IP address with port or URL |
| Base | --db | String | ✖ | Database, if necessary |
| Login | --usr | String | ✖ | Username for authorization |
| Password | --pwd | String | ✖ | Password for authorization |
| Parameters | --params | Structure Of KeyAndValue, Undefined | ✖ | Additional connection parameters |
Returns: String - MongoDB connection string
<br/>
```bsl title="1C:Enterprise/OneScript code example"
Address = "127.0.0.1:1234";
Login = "bayselonarrend";
Password = "12we...";
Base = "main";
ConnectionParams = New Structure("authSource", "admin");
Result = OPI_MongoDB.GenerateConnectionString(Address, Base, Login, Password, ConnectionParams);
```