This commit is contained in:
Jonasz Bigda
2023-03-25 21:51:42 +01:00
parent 0db1d5117e
commit b332e9ceb0
1044 changed files with 37502 additions and 63938 deletions

View File

@@ -37,10 +37,8 @@ class AggregateOperation extends CommandOperationV2 {
this.readPreference = ReadPreference.primary;
}
if (options.explain && (this.readConcern || this.writeConcern)) {
throw new MongoError(
'"explain" cannot be used on an aggregate call with readConcern/writeConcern'
);
if (this.explain && this.writeConcern) {
throw new MongoError('"explain" cannot be used on an aggregate call with writeConcern');
}
if (options.cursor != null && typeof options.cursor !== 'object') {
@@ -83,9 +81,8 @@ class AggregateOperation extends CommandOperationV2 {
command.hint = options.hint;
}
if (options.explain) {
if (this.explain) {
options.full = false;
command.explain = options.explain;
}
command.cursor = options.cursor || {};
@@ -100,7 +97,8 @@ class AggregateOperation extends CommandOperationV2 {
defineAspects(AggregateOperation, [
Aspect.READ_OPERATION,
Aspect.RETRYABLE,
Aspect.EXECUTE_WITH_SELECTION
Aspect.EXECUTE_WITH_SELECTION,
Aspect.EXPLAINABLE
]);
module.exports = AggregateOperation;