Skip to content

Commit 82943c8

Browse files
authored
feat: Changing the sort example for 2 index fields CLOUDP-329033 (#7082)
changing the sort example for 2 index fields
1 parent 6fdde75 commit 82943c8

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

packages/compass-indexes/src/components/create-index-form/index-flow-section.spec.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ describe('IndexFlowSection', () => {
223223
`{"field1":1,"field2":{"$gt":2}}`
224224
);
225225
expect(optimalQueriesExamples).to.contain.text(
226-
`{"field1":1}.sort({"field2":2})`
226+
`{"field1":1}.sort({"field2":1})`
227227
);
228228
});
229229
});

packages/compass-indexes/src/components/create-index-form/index-flow-section.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ export const generateOptimalQueries = (
158158
const lastFieldKey = Object.keys(lastField)[0];
159159

160160
// If there are only two fields, we want to show two examples
161-
// i.e. {a:1, b: {$gt:2}} and {a:1}.sort({b: 2})
161+
// i.e. {a:1, b: {$gt:2}} and {a:1}.sort({b: 1})
162162
if (numOfFields === 2) {
163163
const firstField = coveredQueriesArr[0];
164164
const firstFieldKey = Object.keys(firstField)[0];
@@ -167,7 +167,7 @@ export const generateOptimalQueries = (
167167
<>
168168
{`{"${firstFieldKey}":1,"${lastFieldKey}":{"$gt":2}}`}
169169
<br />
170-
{`{"${firstFieldKey}":1}.sort({"${lastFieldKey}":2})`}
170+
{`{"${firstFieldKey}":1}.sort({"${lastFieldKey}":1})`}
171171
</>
172172
);
173173
}

0 commit comments

Comments
 (0)