Fix incorrect results in collection when models have duplicate ids #1846
Fixes incorrect model attributes when fetching collections that contain models with duplicate primary keys.
If the database contains models with duplicate
See issue #1554 for more info.
These duplicate values are obviously incorrect, but even worse is that the collection
This just ensures that the default documented behavior of
However it is now possible to override this behavior by using both the
This is a breaking change, since previously setting
Current PR Issues
The proposed solution means that you can't both remove non existing models in the new set and maintain duplicates. This kind of makes sense since you're saying that you don't want to remove any models from the collection but you also don't want to merge duplicates, although it may not be very obvious.
This also doesn't change the default of not allowing duplicates by default, but changing that would be an even greater breaking change, since it's very possible that users are using that functionality to merge duplicates into already existing collections. At least one test in the test suite (
As it is, users have to know they want to deal with duplicate
A better alternative would be to allow duplicates by default in