Skip to content

RUBY-3907 Add missing revert_server_monitoring_mode to OptionsMapper - #3120

Open
RaphaelFakhri wants to merge 1 commit into
mongodb:masterfrom
RaphaelFakhri:3907-revert-server-monitoring-mode
Open

RaphaelFakhri wants to merge 1 commit into
mongodb:masterfrom
RaphaelFakhri:3907-revert-server-monitoring-mode

Conversation

@RaphaelFakhri

Copy link
Copy Markdown

Fixes https://jira.mongodb.org/browse/RUBY-3907

serverMonitoringMode is registered with type: :server_monitoring_mode, but Mongo::URI::OptionsMapper only defines convert_server_monitoring_mode and stringify_server_monitoring_mode. ruby_to_smc dispatches to revert_#{type}, so reverting client options that contain :server_monitoring_mode raises:

NoMethodError: undefined method `revert_server_monitoring_mode'

Repro:

Mongo::URI::OptionsMapper.new.ruby_to_smc(server_monitoring_mode: :poll)

Changes

  • Add revert_server_monitoring_mode, which returns the mode as a string, and alias stringify_server_monitoring_mode to it. This follows the existing revert_symbol and revert_read_mode pattern.
  • Sync sdam-options.yml from specifications/source/uri-options/tests/ into spec/spec_tests/data/uri_options/. The URI options runner maps client options back through ruby_to_smc, so the three valid serverMonitoringMode cases cover the revert path.

Testing

bundle exec rspec spec/spec_tests/uri_options_spec.rb
  • Without the lib change: 349 examples, 3 failures (sdam-options.yml serverMonitoringMode=auto|stream|poll creates a client with the correct options, NoMethodError).
  • With the change: 349 examples, 0 failures.

spec/mongo/uri/options_mapper_spec.rb, spec/mongo/uri_spec.rb, spec/spec_tests/connection_string_spec.rb and spec/spec_tests/uri_options_spec.rb pass against a single-node 8.0 replica set (997 examples, 0 failures). RuboCop reports no offenses for lib/mongo/uri/options_mapper.rb.

@RaphaelFakhri
RaphaelFakhri requested a review from a team as a code owner October 27, 2026 14:33
@RaphaelFakhri
RaphaelFakhri requested a review from jamis October 27, 2026 14:33

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant