e-commercee
Version:
This package contains a backend of what would be the logic of a e-commercee software, the architecture used is made in 3 layers
39 lines (30 loc) • 992 B
JavaScript
;
const CommandOperationV2 = require('./command_v2');
const Aspect = require('./operation').Aspect;
const defineAspects = require('./operation').defineAspects;
const MongoDBNamespace = require('../utils').MongoDBNamespace;
class ListDatabasesOperation extends CommandOperationV2 {
constructor(db, options) {
super(db, options);
this.ns = new MongoDBNamespace('admin', '$cmd');
}
execute(server, callback) {
const cmd = { listDatabases: 1 };
if (this.options.nameOnly) {
cmd.nameOnly = Number(cmd.nameOnly);
}
if (this.options.filter) {
cmd.filter = this.options.filter;
}
if (typeof this.options.authorizedDatabases === 'boolean') {
cmd.authorizedDatabases = this.options.authorizedDatabases;
}
super.executeCommand(server, cmd, callback);
}
}
defineAspects(ListDatabasesOperation, [
Aspect.READ_OPERATION,
Aspect.RETRYABLE,
Aspect.EXECUTE_WITH_SELECTION
]);
module.exports = ListDatabasesOperation;