-
Type: Improvement
-
Resolution: Fixed
-
Priority: Minor - P4
-
Affects Version/s: None
-
Component/s: None
-
None
-
Minor Change
This ticket is for changing to use primary read preference for validates_uniqueness_off.
Note that per the comments in https://github.com/mongodb/mongoid/pull/5451, the only validator that Mongoid implements that queries the database is the uniquess one. Applications with custom validatiors should adjust read preference as necessary for their validators.
Original ticket
--------------
The validates uniqueness check can yield a false positive if reading from secondary and there is replication lag (i.e. the secondary does not yet have the conflicting data.) It would be useful to have a global flag to force validates_uniqueness to use read mode: primary. In my opinion this is fine as a global, I don't think we need an option on the validation itself.
- related to
-
MONGOID-4629 Non-block form of persistence context #with
- Backlog