Skip to content

Commit 9f253f3

Browse files
committed
fix: determine Atlas connection from connection String
Atlas Metadata is never set before setting a connection so it is erroneous to use it when connecting. This uses a utility method instead that checks the connection string.
1 parent f933578 commit 9f253f3

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

packages/compass-connections/src/stores/connections-store-redux.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,10 @@ import {
2727
import { getNotificationTriggers } from '../components/connection-status-notifications';
2828
import { openToast, showConfirmation } from '@mongodb-js/compass-components';
2929
import { adjustConnectionOptionsBeforeConnect } from '@mongodb-js/connection-form';
30-
import mongodbBuildInfo, { getGenuineMongoDB } from 'mongodb-build-info';
30+
import mongodbBuildInfo, {
31+
getGenuineMongoDB,
32+
isAtlas,
33+
} from 'mongodb-build-info';
3134
import EventEmitter from 'events';
3235
import { showNonGenuineMongoDBWarningModal as _showNonGenuineMongoDBWarningModal } from '../components/non-genuine-connection-modal';
3336
import ConnectionString from 'mongodb-connection-string-url';
@@ -1556,7 +1559,9 @@ const connectWithOptions = (
15561559
),
15571560
connectionInfo: {
15581561
id: connectionInfo.id,
1559-
isAtlas: !!connectionInfo.atlasMetadata,
1562+
isAtlas: isAtlas(
1563+
connectionInfo.connectionOptions.connectionString
1564+
),
15601565
},
15611566
defaultAppName: appName,
15621567
preferences: {

0 commit comments

Comments
 (0)