Fix mongo database name handling (#2262)

This commit is contained in:
sunghyunkang1111
2025-11-20 12:23:24 -06:00
committed by GitHub
parent c72d921866
commit 0fac59967a

View File

@@ -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)}`);