From f1677de1a63fa9cbe78652cf7680133cdbffb5c5 Mon Sep 17 00:00:00 2001 From: Hao Date: Thu, 21 Sep 2023 22:04:03 +1000 Subject: [PATCH] feat(cli-repl): do not show MDB version for SPI STREAMS-576 (#1678) --- packages/cli-repl/src/mongosh-repl.spec.ts | 24 ++++++++++++++++++++++ packages/cli-repl/src/mongosh-repl.ts | 5 ++++- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/packages/cli-repl/src/mongosh-repl.spec.ts b/packages/cli-repl/src/mongosh-repl.spec.ts index 0df89c472..7f356ac27 100644 --- a/packages/cli-repl/src/mongosh-repl.spec.ts +++ b/packages/cli-repl/src/mongosh-repl.spec.ts @@ -1309,4 +1309,28 @@ describe('MongoshNodeRepl', function () { expect(output).to.not.match(/Using MongoDB/); }); }); + + context('with is_stream: true', function () { + beforeEach(async function () { + sp.getConnectionInfo.resolves({ + extraInfo: { + uri: 'mongodb://localhost:27017/test', + is_localhost: true, + is_stream: true, + }, + buildInfo: { + version: '4.4.1', + }, + }); + mongoshReplOptions.shellCliOptions = { + nodb: false, + }; + mongoshRepl = new MongoshNodeRepl(mongoshReplOptions); + await mongoshRepl.initialize(serviceProvider); + }); + + it('shows Atlas Stream Processing', function () { + expect(output).to.match(/Using MongoDB:\t\tAtlas Stream Processing/); + }); + }); }); diff --git a/packages/cli-repl/src/mongosh-repl.ts b/packages/cli-repl/src/mongosh-repl.ts index 38517c597..d094098c4 100644 --- a/packages/cli-repl/src/mongosh-repl.ts +++ b/packages/cli-repl/src/mongosh-repl.ts @@ -173,7 +173,10 @@ class MongoshNodeRepl implements EvaluationListener { instanceState.setEvaluationListener(this); await instanceState.fetchConnectionInfo(); - let mongodVersion = instanceState.connectionInfo.buildInfo?.version; + const { buildInfo, extraInfo } = instanceState.connectionInfo; + let mongodVersion = extraInfo?.is_stream + ? 'Atlas Stream Processing' + : buildInfo?.version; const apiVersion = serviceProvider.getRawClient()?.serverApi?.version; if (apiVersion) { mongodVersion =