diff --git a/packages/compass-connections/src/utils/connection-supports.spec.ts b/packages/compass-connections/src/utils/connection-supports.spec.ts index de32f2abbcd..0b1631204ef 100644 --- a/packages/compass-connections/src/utils/connection-supports.spec.ts +++ b/packages/compass-connections/src/utils/connection-supports.spec.ts @@ -92,6 +92,9 @@ const mockConnections: ConnectionInfo[] = [ instanceSize: 'M10', clusterType: 'SHARDED', clusterUniqueId: 'clusterUniqueId', + geoSharding: { + selfManagedSharding: false, + }, }, }, { @@ -111,6 +114,26 @@ const mockConnections: ConnectionInfo[] = [ clusterUniqueId: 'clusterUniqueId', }, }, + { + id: 'dedicated-geo-sharded-self-managed', + connectionOptions: { + connectionString: 'mongodb://foo', + }, + atlasMetadata: { + orgId: 'orgId', + projectId: 'projectId', + clusterName: 'clusterName', + regionalBaseUrl: 'https://example.com', + metricsId: 'metricsId', + metricsType: 'cluster', + instanceSize: 'M30', + clusterType: 'GEOSHARDED', + clusterUniqueId: 'clusterUniqueId', + geoSharding: { + selfManagedSharding: true, + }, + }, + }, ]; function connectionInfoById(connectionId: string): ConnectionInfo { @@ -195,5 +218,14 @@ describe('connectionSupports', function () { ) ).to.be.true; }); + + it('should return false if the cluster type is geosharded but self managed', function () { + expect( + connectionSupports( + connectionInfoById('dedicated-geo-sharded-self-managed'), + 'globalWrites' + ) + ).to.be.false; + }); }); }); diff --git a/packages/compass-connections/src/utils/connection-supports.ts b/packages/compass-connections/src/utils/connection-supports.ts index cec5c564462..09fefb9e20e 100644 --- a/packages/compass-connections/src/utils/connection-supports.ts +++ b/packages/compass-connections/src/utils/connection-supports.ts @@ -30,7 +30,10 @@ function supportsGlobalWrites(connectionInfo: ConnectionInfo) { return false; } - return atlasMetadata.clusterType === 'GEOSHARDED'; + return ( + atlasMetadata.clusterType === 'GEOSHARDED' && + !atlasMetadata.geoSharding?.selfManagedSharding + ); } export function connectionSupports( diff --git a/packages/compass-web/src/connection-storage.spec.ts b/packages/compass-web/src/connection-storage.spec.ts index 4f612f5df70..8f33c7797b7 100644 --- a/packages/compass-web/src/connection-storage.spec.ts +++ b/packages/compass-web/src/connection-storage.spec.ts @@ -68,6 +68,9 @@ describe('buildConnectionInfoFromClusterDescription', function () { dataProcessingRegion: { regionalUrl: 'https://example.com', }, + geoSharding: { + selfManagedSharding: true, + }, replicationSpecList: [ { regionConfigs: [ @@ -162,6 +165,10 @@ describe('buildConnectionInfoFromClusterDescription', function () { instanceSize: expectedInstanceSize, regionalBaseUrl: 'https://example.com', clusterType: clusterDescription.clusterType, + geoSharding: { + selfManagedSharding: + clusterDescription.geoSharding?.selfManagedSharding, + }, }); }); } diff --git a/packages/compass-web/src/connection-storage.tsx b/packages/compass-web/src/connection-storage.tsx index c7aa83ae45a..111e2648a0d 100644 --- a/packages/compass-web/src/connection-storage.tsx +++ b/packages/compass-web/src/connection-storage.tsx @@ -38,6 +38,9 @@ type ClusterDescription = { deploymentItemName: string; replicationSpecList?: ReplicationSpec[]; isPaused?: boolean; + geoSharding?: { + selfManagedSharding?: boolean; + }; }; export type ClusterDescriptionWithDataProcessingRegion = ClusterDescription & { @@ -205,6 +208,9 @@ export function buildConnectionInfoFromClusterDescription( ...getMetricsIdAndType(description, deploymentItem), instanceSize: getInstanceSize(description), clusterType: description.clusterType, + geoSharding: { + selfManagedSharding: description.geoSharding?.selfManagedSharding, + }, }, }; } diff --git a/packages/connection-info/src/connection-info.ts b/packages/connection-info/src/connection-info.ts index 7fcaaec6a22..73b46494342 100644 --- a/packages/connection-info/src/connection-info.ts +++ b/packages/connection-info/src/connection-info.ts @@ -56,6 +56,10 @@ export interface AtlasClusterMetadata { * https://github.com/10gen/mms/blob/9e6bf2d81d4d85b5ac68a15bf471dcddc5922323/client/packages/types/nds/clusterDescription.ts#L12-L16 */ clusterType: 'REPLICASET' | 'SHARDED' | 'GEOSHARDED'; + + geoSharding?: { + selfManagedSharding?: boolean; + }; } export interface ConnectionInfo {