-
Type: Improvement
-
Resolution: Unresolved
-
Priority: Trivial - P5
-
None
-
Affects Version/s: None
-
Component/s: Docs
-
None
MONGOID-5633 revealed a lack in our documentation: if someone wants to develop a custom type for a field, they need to make sure the type's #mongoize method is idempotent.
This is because #mongoize may be called on a value that has already been #mongoize'd, such as when creating a record via #first_or_create. In this case, any prior selector (which will have been mongoize'd as it was constructed) will be passed verbatim as attributes to the new document, and then the process of initializing the new document will call #mongoize again on those fields.
So, we need to make sure the documentation mentions that #mongoize needs to be able to accept a value that has already been #mongoize'd.
- documents
-
MONGOID-5633 _id with custom type can't be queried
- Closed