Skip to content

Conversation

@Anemy
Copy link
Member

@Anemy Anemy commented Jan 28, 2025

Copy link
Collaborator

@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

@Anemy Anemy merged commit e8229b1 into main Feb 3, 2025
30 of 32 checks passed
@Anemy Anemy deleted the COMPASS-8854 branch February 3, 2025 15:07
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.

4 participants