From github discussion: https://github.com/mongodb/mongoid/discussions/5540
We are seeing this behavior in 8.1.4
record = Person.first record[nil] undefined method `include?' for nil:NilClass string.include?(".") ^^^^^^^^^ /usr/local/bundle/gems/mongoid-8.1.4/lib/mongoid/attributes.rb:272:in `hash_dot_syntax?': undefined method `include?' for nil:NilClass string.include?(".") ^^^^^^^^^ (NoMethodError) from /usr/local/bundle/gems/mongoid-8.1.4/lib/mongoid/attributes.rb:297:in `read_raw_attribute' from /usr/local/bundle/gems/mongoid-8.1.4/lib/mongoid/attributes.rb:88:in `read_attribute'
I can submit a PR to raise a more helpful Mongoid::Errors::UnknownAttribute instead