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

from_hash modifies given options hash

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

      Using the 2.2.0 version of mongoId, I am calling the from_hash method with a hash that looks similar to this:

      { 'database': 'someName', 'hosts': [[ 'hostname', 27017]] }
      

      The problem is that, in the replset_database.rb file, the hosts key is modified (line 24). This means that after the call to the method. The hosts key looks like this:

      'hosts': [ ['hostname', 27017], { :logger => ... , 'hosts' => ... } ] 
      

      Cloning the argument passed to from_hash doesn't work, because it is not a deep copy. This could be fixed by cloning the hosts key before using it.

            Assignee:
            Unassigned Unassigned
            Reporter:
            sirech Mario Fernandez
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: