Issue #1477
closedWith mongoengine models, developers have to manually configure uniqueness constraints for model unit keys
Description
I was surprised to learn that our Mongoengine conversion requires developers to both identify the unit key, and also install a uniqueness index for it. Pulp's old model code installed the unit key uniqueness constraint for you, so this is a devloper feature regression. Pulp scans the models for the unit key field as is, so it should continue to automatically install uniqueness constraints based on the unit key field.
If we don't do this, it is highly likely that developers will forget to specify the uniqueness constraints in their models as time goes on, which will lead to bugs in code the depends on the constraints. We certainly have code that depends on uniqueness as a technique to work around Mongo's lack of transactions (such as Docker Tags, or the way the resource manager works).
Until this is fixed, I will install a uniqueness constraint on the Docker Tag model to work around it, and the RPM model already seems to have an index being installed.
Related issues
Adds unit-key uniqueness constraint for all unit types
https://pulp.plan.io/issues/1477 re #1477