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

BSON::Document#slice broken for Rails >= 5.2

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • bson-4.4.1
    • Affects Version/s: None
    • Component/s: BSON
    • None
    • Environment:
      apps with gem `rails` >= 2.5

      Affects apps using rails >= 5.2

      Rails 5.2 [dropped the
      ActiveSupport::Hash#slice|https://github.com/rails/rails/commit/a524c955bfcce118da0ecb21affe28e2a102a54b] in favor of ruby's 2.5+ `Hash#slice`

      This breaks the behaviour of `BSON::Document#slice` which relies on the call of `convert_key` method.

      Example:

      ```
      doc = mc.find(name: 'John').first

      doc.class
      => BSON::Document

      doc.slice(:name)
      => {}

      doc.slice('name')
      =>

      { "name" => "John" }

      ```

            Assignee:
            sam.rossi@mongodb.com Samuel Rossi (Inactive)
            Reporter:
            cwd-devops@onpageideas.com Radu Cugut
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: