Uploaded image for project: 'Ruby Driver'
  1. Ruby Driver
  2. RUBY-1045

Collection#insert_one modifies input hash

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor - P4
    • Resolution: Works as Designed
    • Affects Version/s: 2.0.6
    • Fix Version/s: 12_01_17
    • Component/s: Public API
    • Labels:
      None

      Description

      Example:

      doc = {"signature": "ABC", "providers": ["foo", "bar"]}
       
      my_collection.insert_one(doc)
       
      p doc   # => {:signature=>"ABC", :providers=>["foo", "bar"]}
      

      Notice how the keys have been replaced by symbols.

      Functions should never modify their arguments in-place unless it is explicitly documented. In this case, it's obviously a bug. I haven't tested "insert_many" but it might have the same issue.

        Attachments

          Activity

            People

            Assignee:
            emily.stolfo Emily Stolfo
            Reporter:
            Hubro Tomas Sandven [X] (Inactive)
            Participants:
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: