-
Type: Bug
-
Resolution: Unresolved
-
Priority: Unknown
-
Affects Version/s: 8.0.7, 8.1.6, 9.0.2
-
Component/s: Associations
-
None
-
Ruby Drivers
#!/usr/bin/env ruby require 'bundler/inline' gemfile do source 'https://rubygems.org' gem 'mongoid', '8.0.8' end require 'mongoid' Mongoid.configure { |c| c.clients.default = { hosts: ['localhost'], database: 'test' } } puts Mongoid::VERSION puts Mongo::VERSION # broken since https://github.com/mongodb/mongoid/pull/5213 class Purse include Mongoid::Document field :brand, type: String embedded_in :person end class Person include Mongoid::Document include Mongoid::Attributes::Dynamic field :name, type: String embeds_many :purses, store_as: :ps end person = Person.new(ps: [{ brand: 'Gucci' }]) pp person.ps.to_a # save an invalid array to the embeds many field Person.collection.insert_one(:name => "broken", :ps => person.ps.first) matches = Person.with(:read => {:mode => :secondary_preferred}) do |col| col.collection.find(:name => "broken") .projection(:_id => 1, :name => 1, :ps => 1) end pp matches.first pp Person.new(matches.first) # this works in v7.5.4 and fails in latest with error message - undefined method `with_indifferent_access'
We are seeing this failing after upgrading from v7.5.4 to v8.0.8 after this change - https://github.com/mongodb/mongoid/pull/5213 .