Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/cli-repl/src/mongosh-repl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ class MongoshNodeRepl implements EvaluationListener {
internalState.setEvaluationListener(this);
await internalState.fetchConnectionInfo();

const mongodVersion = internalState.connectionInfo.buildInfo.version;
const mongodVersion = internalState.connectionInfo.buildInfo?.version;
await this.greet(mongodVersion);
await this.printStartupLog(internalState);

Expand Down
27 changes: 27 additions & 0 deletions packages/service-provider-core/src/connect-info.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,4 +158,31 @@ describe('getConnectInfo', function() {
null,
TOPOLOGY_WITH_CREDENTIALS)).to.deep.equal(output);
});

it('does not fail when buildInfo is unavailable', function() {
const output = {
is_atlas: false,
is_localhost: false,
server_version: undefined,
mongosh_version: '0.0.6',
is_enterprise: false,
auth_type: 'LDAP',
is_data_lake: false,
dl_version: null,
atlas_version: null,
is_genuine: true,
non_genuine_server_name: 'mongodb',
server_arch: null,
node_version: process.version,
server_os: null,
uri: ''
};
expect(getConnectInfo(
'',
'0.0.6',
null,
CMD_LINE_OPTS,
null,
TOPOLOGY_WITH_CREDENTIALS)).to.deep.equal(output);
});
});
1 change: 1 addition & 0 deletions packages/service-provider-core/src/connect-info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export interface ConnectInfo {
}

export default function getConnectInfo(uri: string, mongoshVersion: string, buildInfo: any, cmdLineOpts: any, atlasVersion: any, topology: any): ConnectInfo {
buildInfo ??= {}; // We're currently not getting buildInfo with --apiStrict.
const { isGenuine: is_genuine, serverName: non_genuine_server_name } =
getBuildInfo.getGenuineMongoDB(buildInfo, cmdLineOpts);
const { isDataLake: is_data_lake, dlVersion: dl_version }
Expand Down