Skip to content

Conversation

johnnyshields
Copy link
Contributor

@johnnyshields johnnyshields commented Sep 29, 2025

Correctly use BSON::Decimal128#to_d if it is available in the driver. Ensures backwards compatibility while avoiding future issues.

Reasoning given here: #6042 (comment)

No additional tests needed as the test runs on different driver versions will suss this out.

Correctly use BSON::Decimal128#to_d if it is available in the driver
@johnnyshields johnnyshields requested a review from a team as a code owner September 29, 2025 14:46
Copy link
Contributor

@Copilot 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 improves the handling of BSON::Decimal128 values in the normalize_value method by preferring the native to_d method when available, falling back to string conversion for older driver versions.

  • Updated normalize_value method to use BSON::Decimal128#to_d when available (driver v5.0.0+)
  • Added fallback to BigDecimal(value.to_s) for backward compatibility with older driver versions

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

@johnnyshields johnnyshields changed the title Correct BSON::Decimal128 handling in normalize_value MONGOID-5890 Correct BSON::Decimal128 handling in normalize_value Sep 29, 2025
@comandeo-mongo comandeo-mongo requested review from comandeo-mongo and removed request for jamis October 1, 2025 13:39
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