X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;ds=sidebyside;f=src%2Fscripts%2FdeleteChargingStations.js;h=4f65bdd3aef1073ecdc9f852a8b86ad5842940bb;hb=14ecae6a3d6b172ca29353e5a2faed513feff4f5;hp=ca5875d383e650d418eed97651496a4ba74933d4;hpb=e7aeea18e189dd087c8f951cf77a253e2818ae90;p=e-mobility-charging-stations-simulator.git diff --git a/src/scripts/deleteChargingStations.js b/src/scripts/deleteChargingStations.js index ca5875d3..4f65bdd3 100755 --- a/src/scripts/deleteChargingStations.js +++ b/src/scripts/deleteChargingStations.js @@ -1,12 +1,13 @@ #!/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 @@ -19,9 +20,9 @@ if (config && config.mongoConnectionString) { 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