Let’s say I have a unique index on a field, or combination of fields:
{recordId:1}, {unique:true}
However, I also have a field “isDeleted: boolean”. If isDeleted is true, I don’t want this object to be considered by the uniqueness constraint. In other words, there can only be 1 record for a given recordId that has isDeleted:false.
Is there a way to express this?
One alternative that was suggested was instead of having isDeleted be a boolean, make it a random string. I’m wondering if there is a more elegant way.