X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fscripts%2FdeleteChargingStations.js;h=4f65bdd3aef1073ecdc9f852a8b86ad5842940bb;hb=29405d4fc27d01f8186482c0826b290152d027fe;hp=3a46893a64cf1b8390aebae84be71d7959198f9f;hpb=251fff5c7fd6f92c1f1acb921233c7e9c7c89003;p=e-mobility-charging-stations-simulator.git diff --git a/src/scripts/deleteChargingStations.js b/src/scripts/deleteChargingStations.js index 3a46893a..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: emobility-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