mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-12-18 16:31:31 +00:00
Fix mongo database name handling (#2262)
This commit is contained in:
@@ -28,7 +28,7 @@ async function main() {
|
||||
const mongoDatabases = await client.mongoDBResources.listMongoDBDatabases(resourceGroupName, account.name);
|
||||
for (const database of mongoDatabases) {
|
||||
// Unfortunately Mongo does not provide a timestamp in ARM. There is no way to tell how old the DB is other thn encoding it in the ID :(
|
||||
const timestamp = Number(database.name.split("-")[1]);
|
||||
const timestamp = Number(database.name.split("_").pop());
|
||||
if (timestamp && timestamp < thirtyMinutesAgo) {
|
||||
await client.mongoDBResources.deleteMongoDBDatabase(resourceGroupName, account.name, database.name);
|
||||
console.log(`DELETED: ${account.name} | ${database.name} | Age: ${friendlyTime(Date.now() - timestamp)}`);
|
||||
|
||||
Reference in New Issue
Block a user