Skip to content

Commit 6d9d8b8

Browse files
only fetch indexes for version 8.1+
1 parent b9be029 commit 6d9d8b8

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

packages/compass-indexes/src/modules/search-indexes.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -602,12 +602,15 @@ const fetchIndexes = (
602602
isReadonlyView,
603603
isWritable,
604604
namespace,
605+
serverVersion,
605606
searchIndexes: { status },
606607
} = getState();
607608

608-
if (!isWritable) {
609-
// remove is ReadOnlyBlocker,
610-
return;
609+
const mongoDBMajorVersion = parseFloat(
610+
serverVersion.split('.').slice(0, 2).join('.')
611+
);
612+
if (isReadonlyView || mongoDBMajorVersion < 8.1 || !isWritable) {
613+
return; // fetch for views 8.1+
611614
}
612615

613616
// If we are already fetching indexes, we will wait for that

packages/compass-indexes/src/stores/store.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,14 @@ export function activateIndexesPlugin(
156156
});
157157

158158
void store.dispatch(fetchRegularIndexes());
159-
if (options.isSearchIndexesSupported || options.isReadonly) {
159+
160+
const mongoDBMajorVersion = parseFloat(
161+
options.serverVersion.split('.').slice(0, 2).join('.')
162+
);
163+
if (
164+
options.isSearchIndexesSupported ||
165+
(options.isReadonly && mongoDBMajorVersion > 8.0)
166+
) {
160167
void store.dispatch(fetchSearchIndexes());
161168
}
162169

0 commit comments

Comments
 (0)