Uploaded image for project: 'Mongoid'
  1. Mongoid
  2. MONGOID-4832

Storing false values in fields of Array and Hash types fails but not in an expected way

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor - P4
    • Resolution: Fixed
    • 7.0.0, 6.2.1, 6.3.0, 6.4.0, 6.4.1, 7.0.1, 7.0.2, 6.4.2, 7.0.3, 6.4.4, 7.0.4, 7.0.5
    • 7.0.6, 7.1.0
    • Attributes
    • None

    Description

      class Person
        include Mongoid::Document
        field :map, type: Hash
      end
       
      person = Person.new
       
      person.map = false
      

      Expected behavior:

      A Mongoid::Errors::InvalidValue error is raised.

      Actual behavior:
      A NoMethodError: undefined method `update_values' for false:FalseClass error is raised.

      Attachments

        Activity

          People

            oleg.pudeyev@mongodb.com Oleg Pudeyev (Inactive)
            gabriel.prado@coffeebeantech.com Gabriel Prado
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: