#!/usr/bin/env node
-const MongoClient = require('mongodb');
const fs = require('fs');
+const MongoClient = require('mongodb');
+
// This script deletes charging stations
// Filter charging stations by id pattern
-// Use Case: charging-stations-simulator creates thousands of charging stations, which are not longer needed.
+// Use Case: e-mobility-charging-stations-simulator creates thousands of charging stations, which are not longer needed.
// Delete these charging stations all at once
// Config
for await (const tenantID of config.tenantIDs) {
const response = await db
- .collection(tenantID + '.chargingstations')
+ .collection(`${tenantID}.chargingstations`)
.deleteMany({ _id: { $regex: config.idPattern } });
- console.log(
+ console.info(
response.deletedCount,
`Charging Stations with id = %${config.idPattern}% deleted. TenantID =`,
tenantID