diff --git a/lib/operations/count.js b/lib/operations/count.js index 5bf03f0858..a7216d6a9e 100644 --- a/lib/operations/count.js +++ b/lib/operations/count.js @@ -1,8 +1,6 @@ 'use strict'; -const Aspect = require('./operation').Aspect; const buildCountCommand = require('./common_functions').buildCountCommand; -const defineAspects = require('./operation').defineAspects; const OperationBase = require('./operation').OperationBase; class CountOperation extends OperationBase { @@ -67,6 +65,4 @@ class CountOperation extends OperationBase { } } -defineAspects(CountOperation, Aspect.SKIP_SESSION); - module.exports = CountOperation; diff --git a/lib/operations/execute_operation.js b/lib/operations/execute_operation.js index da487279e2..80d57857e8 100644 --- a/lib/operations/execute_operation.js +++ b/lib/operations/execute_operation.js @@ -30,11 +30,7 @@ function executeOperation(topology, operation, callback) { throw new TypeError('This method requires a valid operation instance'); } - if ( - isUnifiedTopology(topology) && - !operation.hasAspect(Aspect.SKIP_SESSION) && - topology.shouldCheckForSessionSupport() - ) { + if (isUnifiedTopology(topology) && topology.shouldCheckForSessionSupport()) { return selectServerForSessionSupport(topology, operation, callback); } @@ -43,7 +39,7 @@ function executeOperation(topology, operation, callback) { // The driver sessions spec mandates that we implicitly create sessions for operations // that are not explicitly provided with a session. let session, owner; - if (!operation.hasAspect(Aspect.SKIP_SESSION) && topology.hasSessionSupport()) { + if (topology.hasSessionSupport()) { if (operation.session == null) { owner = Symbol(); session = topology.startSession({ owner }); diff --git a/lib/operations/find.js b/lib/operations/find.js index 6838213c32..5d47db6baa 100644 --- a/lib/operations/find.js +++ b/lib/operations/find.js @@ -28,8 +28,7 @@ class FindOperation extends OperationBase { defineAspects(FindOperation, [ Aspect.READ_OPERATION, Aspect.RETRYABLE, - Aspect.EXECUTE_WITH_SELECTION, - Aspect.SKIP_SESSION + Aspect.EXECUTE_WITH_SELECTION ]); module.exports = FindOperation; diff --git a/lib/operations/operation.js b/lib/operations/operation.js index 471627adc8..fd82e6605b 100644 --- a/lib/operations/operation.js +++ b/lib/operations/operation.js @@ -2,7 +2,6 @@ const Aspect = { READ_OPERATION: Symbol('READ_OPERATION'), - SKIP_SESSION: Symbol('SKIP_SESSION'), WRITE_OPERATION: Symbol('WRITE_OPERATION'), RETRYABLE: Symbol('RETRYABLE'), EXECUTE_WITH_SELECTION: Symbol('EXECUTE_WITH_SELECTION') @@ -12,8 +11,7 @@ const Aspect = { * This class acts as a parent class for any operation and is responsible for setting this.options, * as well as setting and getting a session. * Additionally, this class implements `hasAspect`, which determines whether an operation has - * a specific aspect, including `SKIP_SESSION` and other aspects to encode retryability - * and other functionality. + * a specific aspect. */ class OperationBase { constructor(options) { diff --git a/lib/operations/remove_user.js b/lib/operations/remove_user.js index 9a59744d07..9e8376b1a2 100644 --- a/lib/operations/remove_user.js +++ b/lib/operations/remove_user.js @@ -47,6 +47,6 @@ class RemoveUserOperation extends CommandOperation { } } -defineAspects(RemoveUserOperation, [Aspect.WRITE_OPERATION, Aspect.SKIP_SESSIONS]); +defineAspects(RemoveUserOperation, Aspect.WRITE_OPERATION); module.exports = RemoveUserOperation;