-
Type: Improvement
-
Resolution: Done
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: None
-
None
I'm not certain if this is newly intended behaviour, but now an UnknownAttribute exception is thrown whenever you call .clone on a document that contains deprecated data (that is, it was assigned data under an old schema containing that attribute, but the attribute has since been removed from the model).
I find one of the major advantages of Mongo is the flexible data model that allows for easy changes to the schema while retaining deprecated data, so hopefully this isn't the intended behaviour! Explicitly including Dynamic::Attributes would solve the issue, but this would undesirably throw-away enforcement of the schema on new documents. IMO, when cloning old documents, the deprecated attributes should be copied or possibly silently ignored.
This PR fixes the issue by copying them, but let me know if a different approach would be favourable...
- depends on
-
MONGOID-4182 Copyable can modify program behavior at runtime
- Closed