Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(schema): run schema analysis with secondaryPreferred when read pref not set COMPASS-8854 #6665

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Anemy
Copy link
Member

@Anemy Anemy commented Jan 28, 2025

Copy link
Contributor

@paula-stacho paula-stacho left a comment

Choose a reason for hiding this comment

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

You forgot to add 'mongodb-connection-string-url' to dependencies, but otherwise neat! 🎉

Comment on lines +217 to +221
function isReadPreferenceSet(connectionString: string): boolean {
return !!new ConnectionString(connectionString).searchParams.get(
'readPreference'
);
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not a strong preference, but I feel like dataService might be a better place for this logic, it feels out of the domain of the schema plugin to know how to extract connection options from the connection info string.

Maybe we can make this an interface on the sample method? Something like fallbackReadPreference or defaultReadPreference option that we can pass to the method and will be only applied by the sample method using the same logic you implemented here? After all dataService is there to abstract away some parts of interacting with the driver for feature code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants