-
Type: Epic
-
Resolution: Done
-
Priority: Unknown
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
Done
-
Comprehensive mongoization/demongoization/evolution (comp)
-
6
-
5
-
5
-
100
-
Summary
Mongoid allows applications to define field types for their fields. Subsequently there are several operations that convert values to these types from other types:
- mongoization: when storing a value in a model instance
- evolution: when storing a value in a Criteria object for a query
- demongoization: when reading a value from the database and writing to model attributes
In all of these operations, the input value can generally be of any type. Because of this the actual conversion logic is non-trivial and several of the cases have been reported to not work correctly.
The scope of this epic is a thorough review of the behavior in question for all possible inputs and repair of any incorrect behavior.
Changes
- Populate attributes_before_type_cast on read from database -
MONGOID-5404. This will provide a place to store incoming values when they cannot be mongoized or demongoized. (The storage is already done for mongoization, the change is to also add it for demongoization) - Always mongoize uncastable values to nil -
MONGOID-5222. This will address inconsistent mongoization. Unlike ActiveRecord we will no longer sometimes convert uncastable values to default values for the desired type, or perform conversions of partial input. - Always demongoize uncastable values to nil -
MONGOID-5221. This will address inconsistent demongoization. Just like with mongoization, we will no longer replace uncastable values with default values and we will not convert partial input. Population of attributes_before_type_cast is the required prerequisite for this change. - Pass through uncastable values in evolve -
MONGOID-5386. For evolution, we can send any value in a query to the server, and this behavior makes sense therefore uncastable values will be forwarded as they are.
Motivation
Who is the affected end user?
Who are the stakeholders?
How does this affect the end user?
Are they blocked? Are they annoyed? Are they confused?
How likely is it that this problem or use case will occur?
Main path? Edge case?
If the problem does occur, what are the consequences and how severe are they?
Minor annoyance at a log message? Performance concern? Outage/unavailability? Failover can't complete?
Is this issue urgent?
Does this ticket have a required timeline? What is it?
Is this ticket required by a downstream team?
Needed by e.g. Atlas, Shell, Compass?
Is this ticket only for tests?
Is this ticket have any functional impact, or is it just test improvements?
Cast of Characters
Engineering Lead:
Document Author:
POCers:
Product Owner:
Program Manager:
Stakeholders:
Channels & Docs
Slack Channel
[Scope Document|some.url]
[Technical Design Document|some.url]
- is related to
-
MONGOID-5405 Attribute storage refactoring
- Backlog