Cleanup
This commit is contained in:
13
node_modules/mongodb/lib/operations/operation.js
generated
vendored
13
node_modules/mongodb/lib/operations/operation.js
generated
vendored
@@ -1,10 +1,15 @@
|
||||
'use strict';
|
||||
|
||||
const Explain = require('../explain').Explain;
|
||||
const MongoError = require('../core/error').MongoError;
|
||||
|
||||
const Aspect = {
|
||||
READ_OPERATION: Symbol('READ_OPERATION'),
|
||||
WRITE_OPERATION: Symbol('WRITE_OPERATION'),
|
||||
RETRYABLE: Symbol('RETRYABLE'),
|
||||
EXECUTE_WITH_SELECTION: Symbol('EXECUTE_WITH_SELECTION')
|
||||
EXECUTE_WITH_SELECTION: Symbol('EXECUTE_WITH_SELECTION'),
|
||||
NO_INHERIT_OPTIONS: Symbol('NO_INHERIT_OPTIONS'),
|
||||
EXPLAINABLE: Symbol('EXPLAINABLE')
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -16,6 +21,12 @@ const Aspect = {
|
||||
class OperationBase {
|
||||
constructor(options) {
|
||||
this.options = Object.assign({}, options);
|
||||
|
||||
if (this.hasAspect(Aspect.EXPLAINABLE)) {
|
||||
this.explain = Explain.fromOptions(options);
|
||||
} else if (this.options.explain !== undefined) {
|
||||
throw new MongoError(`explain is not supported on this command`);
|
||||
}
|
||||
}
|
||||
|
||||
hasAspect(aspect) {
|
||||
|
||||
Reference in New Issue
Block a user