Skip to main content

Delete collection

Deletes the selected database collection

Function DeleteCollection(Val Connection, Val Collection, Val Base = Undefined) Export

ParameterCLI optionTypeRequiredDescription
Connection--dbcString, ArbitraryConnection or connection string
Collection--collStringCollection name
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);

Collection = "test_collection";
Base = "test_database";

Result = OPI_MongoDB.DeleteCollection(Connection, Collection, Base);
oint mongodb DeleteCollection \
--dbc "mongodb://bayselonarrend:12we3456!2154@127.0.0.1:27017/?authSource=admin" \
--coll "test_collection" \
--db "test_database"
Result
{
"result": true,
"data": {
"nIndexesWas": 1,
"ns": "test_database.test_collection",
"ok": 1
}
}