Advertisement
Guest User

Untitled

a guest
Jul 21st, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Simple script to clean out any collections which are temporal
  2. var collections = db.getCollectionNames();
  3.  
  4. for(var i in collections) {
  5.     if (collections[i].match(/(^log_|_temp_)/)) {
  6.         if (db[collections[i]].drop()) {
  7.             collections[i] = collections[i].replace(/\s$/, '');
  8.             print('Dropped ' + collections[i]);
  9.         } else {
  10.             collections[i] = collections[i].replace(/\s$/, '');
  11.             print('db.' + collections[i] + '.drop();');
  12.         }
  13.     }
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement