It's a type of Planche
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

mongo_compact_all 606B

123456789101112131415
  1. https://gist.github.com/BlakeGardner/8548102
  2. mongo "mongodb://admin:$(salt-call pillar.get mongodb:server:admin:password --out=newline_values_only)@localhost/?authSource=admin&ssl=false"
  3. rs.secondaryOk();
  4. db.getMongo().getDBNames().forEach(function(dbName) {
  5. if (!(["local", "admin", "system"].includes(dbName))) {
  6. var subject = db.getSiblingDB(dbName);
  7. subject.getCollectionNames().forEach(function (collectionName) {
  8. print('Compacting: ' +dbName + " - " + collectionName);
  9. subject.runCommand({ compact: collectionName, force: true });
  10. });
  11. }
  12. });