Files
edx-platform/scripts/delete-mongo-test-dbs.js
Mohammad Ahtasham ul Hassan 8320dcb0e8 build: update stylint and eslint thresholds (#29471)
* build: update stylint and eslint thresholds

* Removed stylint threshold

* Update test_stylelint.py

* fix: fix eslint issues
2021-12-07 20:09:13 +05:00

25 lines
597 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();
}
}