Skip to content

Conversation

@DarshanaVenkatesh
Copy link
Collaborator

@DarshanaVenkatesh DarshanaVenkatesh commented Aug 20, 2025

Description

Disable search stages for views depending on version/if incompatible with search.

  • If <8.0, disable search stages for views with added text 'Atlas only. Requires MongoDB 8.1+ to run on a view.'
  • If 8.0, disable search stages for views with added text 'Atlas only. Requires MongoDB 8.1+ to run on a view. To use a search index on a view on MongoDB 8.0, query the view’s source collection sourceName.'
  • If not search queryable, disable search stage for views with added text 'Atlas only. Only views containing $match stages with the $expr operator, $addFields, or $set are compatible with search indexes.'
  • I also changed the order to say match stages with expr first in all error/banner messages.
disable_search_stages.mov

Checklist

  • New tests and/or benchmarks are included
  • Documentation is changed or added
  • If this change updates the UI, screenshots/videos are added and a design review is requested
  • I have signed the MongoDB Contributor License Agreement (https://www.mongodb.com/legal/contributor-agreement)

Motivation and Context

  • Bugfix
  • New feature
  • Dependency update
  • Misc

Open Questions

Dependents

Types of changes

  • Backport Needed
  • Patch (non-breaking change which fixes an issue)
  • Minor (non-breaking change which adds functionality)
  • Major (fix or feature that would cause existing functionality to change)

@github-actions github-actions bot added the feat label Aug 20, 2025
@DarshanaVenkatesh DarshanaVenkatesh added the no release notes Fix or feature not for release notes label Aug 21, 2025
@DarshanaVenkatesh DarshanaVenkatesh marked this pull request as ready for review August 25, 2025 07:42
@Copilot Copilot AI review requested due to automatic review settings August 25, 2025 07:42
@DarshanaVenkatesh DarshanaVenkatesh requested a review from a team as a code owner August 25, 2025 07:42
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds support for search stages in aggregation views with version and compatibility checks. The changes implement conditional disabling of search stages based on MongoDB version compatibility and view pipeline queryability requirements.

  • Adds version compatibility checks for search stages on views (MongoDB 8.0+/8.1+ requirement)
  • Implements pipeline queryability validation for search index compatibility
  • Updates collection stats to include pipeline information for view compatibility checks

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
packages/compass-aggregations/src/modules/collection-stats.ts Adds pipeline field to collection stats to support view compatibility checks
packages/compass-aggregations/src/components/stage-toolbar/stage-operator-select.tsx Implements search stage validation logic with version checks and dynamic descriptions

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@lerouxb
Copy link
Contributor

lerouxb commented Aug 25, 2025

Can you explain somewhere why DE and Compass have different minimum server versions?

@DarshanaVenkatesh
Copy link
Collaborator Author

DarshanaVenkatesh commented Aug 26, 2025

Can you explain somewhere why DE and Compass have different minimum server versions?

Sorry I misunderstood something but yes you're right DE itself isn't related to server version 8.1+. ̶W̶e̶ ̶a̶r̶e̶ ̶n̶o̶t̶ ̶d̶i̶s̶p̶l̶a̶y̶i̶n̶g̶ ̶t̶h̶e̶ ̶s̶e̶a̶r̶c̶h̶ ̶s̶t̶a̶g̶e̶s̶ ̶i̶n̶ ̶D̶a̶t̶a̶ ̶E̶x̶p̶l̶o̶r̶e̶r̶,̶ ̶o̶n̶l̶y̶ ̶C̶o̶m̶p̶a̶s̶s̶. I removed the extra check and made it only check Compass version for compatibility.

@gribnoysup
Copy link
Collaborator

Hey @DarshanaVenkatesh, can you clarify, if we don't need to differenciate by version here, does it also mean we didn't need to do it in this PR? Because Le Roux is basically asking the same thing I asked you before, so just want to make sure we're not introducing unexpected differences in behavior for desktop and web that otherwise in most cases always behave the same

@DarshanaVenkatesh
Copy link
Collaborator Author

Hey @DarshanaVenkatesh, can you clarify, if we don't need to differenciate by version here, does it also mean we didn't need to do it in this PR? Because Le Roux is basically asking the same thing I asked you before, so just want to make sure we're not introducing unexpected differences in behavior for desktop and web that otherwise in most cases always behave the same

That pr should differentiate in the banners because we want to direct users to the atlas search indexes page for data explorer. So yes, we want banners with the server version difference because that's mentioning the server version in Atlas vs Compass (not necessarily data explorer).

@DarshanaVenkatesh DarshanaVenkatesh changed the title feat(compass-aggregations): add search stages for views COMPASS-9693 feat(compass-aggregations): disable search stages for incompatible views COMPASS-9693 Aug 26, 2025
Comment on lines 100 to 104
// filter out search stages for data explorer
const filteredStages =
isReadonlyView && !enableAtlasSearchIndexes
? stages.filter((stage) => !isSearchStage(stage.name))
: stages;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is this requirement coming from? This is a weird change in compass behavior only for data explorer. Why are you not allowed to see actually working stages in aggregation builder based on a completely different feature?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing this! Sorry for the back and forth. The final implementation will have both of them work the same for compass and de! Will ping you after I update this pr but both will have search stages with the same messages.

@DarshanaVenkatesh DarshanaVenkatesh merged commit 333c116 into main Sep 3, 2025
59 checks passed
@DarshanaVenkatesh DarshanaVenkatesh deleted the COMPASS-9693 branch September 3, 2025 18:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feat no release notes Fix or feature not for release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants