MCPcopy Create free account
hub / github.com/CloudBoost/cloudboost / _getDatabases

Function _getDatabases

cron/expire.js:46–71  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

44
45
46function _getDatabases() {
47 const deferred = q.defer();
48
49 try {
50 config.mongoClient.command({ listDatabases: 1 }, (err, databaseStatList) => {
51 if (err) {
52 deferred.reject(err);
53 } else if (databaseStatList) {
54 // Exclude Databases
55 const excludeDBList = ['_Analytics', '_GLOBAL', 'local'];
56 const databaseNameList = [];
57 for (let i = 0; i < databaseStatList.databases.length; ++i) {
58 if (excludeDBList.indexOf(databaseStatList.databases[i].name) < 0) {
59 databaseNameList.push(databaseStatList.databases[i].name);
60 }
61 }
62
63 deferred.resolve(databaseNameList);
64 }
65 });
66 } catch (err) {
67 winston.log('error', { error: String(err), stack: new Error().stack });
68 }
69
70 return deferred.promise;
71}
72
73const job = new CronJob('00 00 22 * * *', (() => {
74 try {

Callers 1

expire.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected