diff --git a/src/Explorer/Controls/Settings/SettingsRenderUtils.tsx b/src/Explorer/Controls/Settings/SettingsRenderUtils.tsx
index 2c1ece979..003b665f8 100644
--- a/src/Explorer/Controls/Settings/SettingsRenderUtils.tsx
+++ b/src/Explorer/Controls/Settings/SettingsRenderUtils.tsx
@@ -441,6 +441,13 @@ export const mongoIndexingPolicyDisclaimer: JSX.Element = (
);
+export const mongoCompoundIndexNotSupportedMessage: JSX.Element = (
+
+ Collections with compound indexes are not yet supported in the indexing editor. To modify indexing policy for this
+ collection, use the Mongo Shell.
+
+);
+
export const mongoIndexingPolicyAADError: JSX.Element = (
diff --git a/src/Explorer/Controls/Settings/SettingsSubComponents/MongoIndexingPolicy/MongoIndexingPolicyComponent.test.tsx b/src/Explorer/Controls/Settings/SettingsSubComponents/MongoIndexingPolicy/MongoIndexingPolicyComponent.test.tsx
index 07cee23d7..b0f8e9e57 100644
--- a/src/Explorer/Controls/Settings/SettingsSubComponents/MongoIndexingPolicy/MongoIndexingPolicyComponent.test.tsx
+++ b/src/Explorer/Controls/Settings/SettingsSubComponents/MongoIndexingPolicy/MongoIndexingPolicyComponent.test.tsx
@@ -36,6 +36,14 @@ describe("MongoIndexingPolicyComponent", () => {
expect(wrapper).toMatchSnapshot();
});
+ it("error shown for collection with compound indexes", () => {
+ const props = { ...baseProps, mongoIndexes: [{ key: { keys: ["prop1", "prop2"] } }] };
+ const wrapper = shallow();
+ expect(wrapper).toMatchSnapshot();
+ const mongoIndexingPolicyComponent = wrapper.instance() as MongoIndexingPolicyComponent;
+ expect(mongoIndexingPolicyComponent.hasCompoundIndex()).toBeTruthy();
+ });
+
describe("AddMongoIndexProps test", () => {
const wrapper = shallow();
const mongoIndexingPolicyComponent = wrapper.instance() as MongoIndexingPolicyComponent;
diff --git a/src/Explorer/Controls/Settings/SettingsSubComponents/MongoIndexingPolicy/MongoIndexingPolicyComponent.tsx b/src/Explorer/Controls/Settings/SettingsSubComponents/MongoIndexingPolicy/MongoIndexingPolicyComponent.tsx
index 506acdee7..5493f7dda 100644
--- a/src/Explorer/Controls/Settings/SettingsSubComponents/MongoIndexingPolicy/MongoIndexingPolicyComponent.tsx
+++ b/src/Explorer/Controls/Settings/SettingsSubComponents/MongoIndexingPolicy/MongoIndexingPolicyComponent.tsx
@@ -24,6 +24,7 @@ import {
indexingPolicynUnsavedWarningMessage,
infoAndToolTipTextStyle,
onRenderRow,
+ mongoCompoundIndexNotSupportedMessage,
} from "../../SettingsRenderUtils";
import { MongoIndex } from "../../../../../Utils/arm/generatedClients/2020-04-01/types";
import {
@@ -282,6 +283,15 @@ export class MongoIndexingPolicyComponent extends React.Component {
+ for (let index = 0; index < this.props.mongoIndexes.length; index++) {
+ if (this.props.mongoIndexes[index].key?.keys?.length > 1) {
+ return true;
+ }
+ }
+ return false;
+ };
+
private renderWarningMessage = (): JSX.Element => {
let warningMessage: JSX.Element;
if (this.getMongoWarningNotificationMessage()) {
@@ -303,6 +313,9 @@ export class MongoIndexingPolicyComponent extends React.Component
{this.renderWarningMessage()}
diff --git a/src/Explorer/Controls/Settings/SettingsSubComponents/MongoIndexingPolicy/__snapshots__/MongoIndexingPolicyComponent.test.tsx.snap b/src/Explorer/Controls/Settings/SettingsSubComponents/MongoIndexingPolicy/__snapshots__/MongoIndexingPolicyComponent.test.tsx.snap
index 577fa2862..06443ee16 100644
--- a/src/Explorer/Controls/Settings/SettingsSubComponents/MongoIndexingPolicy/__snapshots__/MongoIndexingPolicyComponent.test.tsx.snap
+++ b/src/Explorer/Controls/Settings/SettingsSubComponents/MongoIndexingPolicy/__snapshots__/MongoIndexingPolicyComponent.test.tsx.snap
@@ -1,5 +1,11 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
+exports[`MongoIndexingPolicyComponent error shown for collection with compound indexes 1`] = `
+
+ Collections with compound indexes are not yet supported in the indexing editor. To modify indexing policy for this collection, use the Mongo Shell.
+
+`;
+
exports[`MongoIndexingPolicyComponent renders 1`] = `
{
explorer.databaseAccount(emulatorAccount);
explorer.isAccountReady(true);
} else if (config.platform === Platform.Portal) {
+ window.authType = AuthType.AAD;
explorer = new Explorer();
// In development mode, try to load the iframe message from session storage.