BigDecimal stored as Int or Double if passed as Integer or Float

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Done
    • 3.0.7
    • Affects Version/s: None
    • Component/s: None
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      I'm not sure if it is the expected behavior, but I think it's really strange :

      class Item
        include Mongoid::Document
      
        field :price, type: BigDecimal
      end
      
      Item.create price: 12
      # price is stored as an Int in MongoDB
      
      Item.create price: 12.5
      # price is stored as a Double in MongoDB
      
      Item.create price: BigDecimal.new('12.5')
      # price is stored as a String in MongoDB (as expected)
      

              Assignee:
              Durran Jordan
              Reporter:
              fklingler
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved: