Simple Chat Room in NodeJS, expressJS and mongoDB in Docker Swarm
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
831 B

4 years ago
'use strict';
const CommandOperation = require('./command');
class ProfilingLevelOperation extends CommandOperation {
constructor(db, command, options) {
super(db, options);
}
_buildCommand() {
const command = { profile: -1 };
return command;
}
execute(callback) {
super.execute((err, doc) => {
if (err == null && doc.ok === 1) {
const was = doc.was;
if (was === 0) return callback(null, 'off');
if (was === 1) return callback(null, 'slow_only');
if (was === 2) return callback(null, 'all');
return callback(new Error('Error: illegal profiling level value ' + was), null);
} else {
err != null ? callback(err, null) : callback(new Error('Error with profile command'), null);
}
});
}
}
module.exports = ProfilingLevelOperation;