From b424edfd60c51076ddbdc96e9d4b6986e890fb23 Mon Sep 17 00:00:00 2001 From: Michael Rose Date: Tue, 29 Jun 2021 09:46:34 +0200 Subject: [PATCH] fix(shell-api): explain.count uses correct namespace MONGOSH-853 --- packages/shell-api/src/explainable.ts | 2 +- packages/shell-api/src/integration.spec.ts | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/shell-api/src/explainable.ts b/packages/shell-api/src/explainable.ts index 6287dce4d2..3105e1dad0 100644 --- a/packages/shell-api/src/explainable.ts +++ b/packages/shell-api/src/explainable.ts @@ -121,7 +121,7 @@ export default class Explainable extends ShellApiWithMongoClass { // This is the only one that currently lacks explicit driver support. return markAsExplainOutput(await this._collection._database._runCommand({ explain: { - count: `${this._collection._database._name}.${this._collection._name}`, + count: `${this._collection._name}`, query, ...options }, diff --git a/packages/shell-api/src/integration.spec.ts b/packages/shell-api/src/integration.spec.ts index 0d3c5a1e04..af75cf6e69 100644 --- a/packages/shell-api/src/integration.spec.ts +++ b/packages/shell-api/src/integration.spec.ts @@ -1270,6 +1270,7 @@ describe('Shell API (integration)', function() { const explained = await collection.explain().count(); expect(explained).to.include.all.keys(['ok', 'serverInfo', 'queryPlanner']); expect(explained).to.not.include.any.keys(['executionStats']); + expect(explained.queryPlanner.namespace).to.equal(`${dbName}.${collectionName}`); }); it('includes executionStats when requested', async() => {