* fix: multi lines and spaces issues * fix: eslint operator-linebreak issue * fix: eslint quotes issue * fix: remaining quotes issues * fix: eslint object curly newline issue * fix: eslint object curly spacing issue * fix: eslint brace-style issues * fix: react jsx indent and props issues * fix: eslint trailing spaces issues * fix: eslint linbreak style issue * fix: eslint space unary operator issue * fix: eslint line around directives issue * fix: void and typeof space unary ops issue
24 lines
596 B
JavaScript
24 lines
596 B
JavaScript
/*
|
|
Drop all Mongo test databases.
|
|
|
|
Usage example:
|
|
|
|
mongo delete-mongo-test-dbs.js
|
|
|
|
will drop every database that starts with "test_" or "acceptance_",
|
|
but ignore other databases.
|
|
*/
|
|
|
|
String.prototype.startsWith = function(substring) {
|
|
return (this.indexOf(substring) === 0);
|
|
};
|
|
|
|
var dbNameList = db.getMongo().getDBNames();
|
|
for (var i in dbNameList) {
|
|
if (dbNameList[i].startsWith('test_') || dbNameList[i].startsWith('acceptance_')) {
|
|
dbToDrop = db.getMongo().getDB(dbNameList[i]);
|
|
print('Dropping test db ' + dbNameList[i]);
|
|
dbToDrop.dropDatabase();
|
|
}
|
|
}
|