批量删除test开头的表
db.getCollectionNames().forEach(function(collectionName) { if (collectionName.startsWith('test')) { db.getCollection(collectionName).deleteMany({}); print(`Collection ${collectionName} has been cleared`); } });
db.getCollectionNames().forEach(function(collectionName) { if (collectionName.startsWith('test')) { db.getCollection(collectionName).deleteMany({}); print(`Collection ${collectionName} has been cleared`); } });