-
Type: Bug
-
Resolution: Done
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: None
-
None
I recently dealt with an issue that took about 12 hours of debugging and came down to using a field name that isn't allowed. Throughout the debugging process, Mongoid gave no indication that I had used an un-permitted field name.
Here is a SO post detailing debugging the issue: http://stackoverflow.com/questions/42423511/updating-a-rails-models-attributes-through-mongoid-using-normal-persistence-met
The actual issue is caused by me using the field name "collection_name". While choosing the field name, I recognized that "collection" might pose issues but thought adding "_name" would avoid it somehow. It is caused by a clash with this method's name: https://github.com/mongodb/mongoid/blob/master/lib/mongoid/persistence_context.rb#L82
I believe that Mongoid should somehow warn the user of this. I don't see a properly documented list of disallowed field names either.
- is related to
-
MONGOID-4444 Field names display and options are on prohibited_methods list
- Closed