-
Type: Bug
-
Resolution: Works as Designed
-
Priority: Unknown
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
When upgrading from Mongoid 7.4.0 to Mongoid 7.5.1 we're detecting a behavioral change that doesn't seem to be documented in the release notes.
It might not be intended as the expected behavior is still documented for version 8.0.
We're defining a document as follows:
class Something include Mongoid::Document store_in collection: 'some_things' field :n, type: String field :h, type: Hash, default: {} validates :n, presence: true def self.model_name ActiveModel::Name.new(self, nil, 'foo') end end
Behavior with Mongoid 7.4:
Something.create(n: 'test', h: { 'some.key': 'value' }) #! BSON::String::IllegalKey: 'some.key' is an illegal key in MongoDB. Keys may not start with '$' or contain a '.'. #! from /Users/simonc/.gem/ruby/2.7.6/gems/bson-4.15.0/lib/bson/hash.rb:43:in `put_hash'
Behavior with Mongoid 7.5:
Something.create(n: 'test', h: { 'some.key': 'value' }) #=> #<Something _id: 62e10ef0c24c842695b6517e, n: "test", h: {:"some.key"=>"value"}>
- is caused by
-
RUBY-2528 Permit inserting dollar-prefixed or dotted keys
- Closed