Skip to content

Commit

Permalink
fixed server version error for aggregate
Browse files Browse the repository at this point in the history
  • Loading branch information
malikj2000 committed Jun 27, 2023
1 parent 39a29b6 commit 880ad39
Showing 1 changed file with 29 additions and 8 deletions.
37 changes: 29 additions & 8 deletions test/integration/crud/explain.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {

const explain = [true, false, 'queryPlanner', 'allPlansExecution', 'executionStats', 'invalid'];

describe('Explain', function () {
describe.only('Explain', function () {
let client: MongoClient;
let db: Db;
let collection: Collection;
Expand Down Expand Up @@ -88,8 +88,14 @@ describe('Explain', function () {
case 'allPlansExecution':
expect(commandStartedEvent[0].command.verbosity).to.be.equal('allPlansExecution');
if (name === 'aggregate') {
expect(response[0]).to.have.property('queryPlanner');
expect(response[0]).nested.property('executionStats.allPlansExecution').to.exist;
if (response.stages) {
expect(response.stages[0]).to.have.property('queryPlanner');
expect(response.stages[0]).nested.property('executionStats.allPlansExecution').to
.exist;
} else {
expect(response[0]).to.have.property('queryPlanner');
expect(response[0]).nested.property('executionStats.allPlansExecution').to.exist;
}
} else {
expect(response).to.have.property('queryPlanner');
expect(response).nested.property('executionStats.allPlansExecution').to.exist;
Expand All @@ -99,8 +105,13 @@ describe('Explain', function () {
case 'queryPlanner':
expect(commandStartedEvent[0].command.verbosity).to.be.equal('queryPlanner');
if (name === 'aggregate') {
expect(response[0]).to.have.property('queryPlanner');
expect(response[0]).to.not.have.property('executionStats');
if (response.stages) {
expect(response.stages[0]).to.have.property('queryPlanner');
expect(response.stages[0]).to.not.have.property('executionStats');
} else {
expect(response[0]).to.have.property('queryPlanner');
expect(response[0]).to.not.have.property('executionStats');
}
} else {
expect(response).to.have.property('queryPlanner');
expect(response).to.not.have.property('executionStats');
Expand All @@ -109,9 +120,19 @@ describe('Explain', function () {
case 'executionStats':
expect(commandStartedEvent[0].command.verbosity).to.be.equal('executionStats');
if (name === 'aggregate') {
expect(response[0]).to.have.property('queryPlanner');
expect(response[0]).to.have.property('executionStats');
expect(response[0]).to.not.have.nested.property('executionStats.allPlansExecution');
if (response.stages) {
expect(response.stages[0]).to.have.property('queryPlanner');
expect(response.stages[0]).to.have.property('executionStats');
expect(response.stages[0]).to.not.have.nested.property(
'executionStats.allPlansExecution'
);
} else {
expect(response[0]).to.have.property('queryPlanner');
expect(response[0]).to.have.property('executionStats');
expect(response[0]).to.not.have.nested.property(
'executionStats.allPlansExecution'
);
}
} else {
expect(response).to.have.property('queryPlanner');
expect(response).to.have.property('executionStats');
Expand Down

0 comments on commit 880ad39

Please sign in to comment.