Schema Specification for a Document - Is There a Way to Specify That Field To Be Unique?
Last updated: Jul 13, 2020
In schema specification for a document, is there a way to specify that I want a field to be unique? That no two documents with the same content in that field can exist? I find myself cleaning up duplicates quite a lot...
Jul 10, 2020, 7:44 PM
If this is an array field for example, you could add the
function to the validation. This requires all values within the array to be unique by doing a deep comparison.
Well I was a bit quick on reporting success with the validation rule here. The
rule is not valid on document descriptors. I wish it was. That leaves me with trying to create a custom rule which queries for document keys on input. Anybody have a clue as to how I can query existing objects inside a custom rule?