Skip to main content

Get collection list

Gets a list of database collections

Function GetCollectionList(Val Connection, Val Base = Undefined) Export

ParameterCLI optionTypeRequiredDescription
Connection--dbcString, ArbitraryConnection or connection string
Base--dbStringDatabase name. Current database if not specified
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);
Connection = OPI_MongoDB.CreateConnection(ConnectionString);

Base = "test_database";

Result = OPI_MongoDB.GetCollectionList(Connection, Base);
oint mongodb GetCollectionList \
--dbc "mongodb://bayselonarrend:12we3456!2154@127.0.0.1:27017/?authSource=admin" \
--db "test_database"
Result
{
"data": {
"cursor": {
"firstBatch": [
{
"idIndex": {
"key": {
"_id": 1
},
"name": "_id_",
"v": 2
},
"info": {
"readOnly": false,
"uuid": "<Binary data>"
},
"name": "test_collection",
"options": {
"validator": {
"$expr": [
{
"$gte": [
"$total",
0
]
},
{
"$lte": [
"$status",
3
]
}
]
}
},
"type": "collection"
}
],
"id": 0,
"ns": "test_database.$cmd.listCollections"
},
"ok": 1
},
"result": true
}