Hi all,
I know that the general way to model a unique constraint/unique index concept is to use document lookup. I have a few questions related to this approach:
-
Using the example found here1, when processing/trying to insert a parent document, the e-mail could be check first with a lookup (KV). Won’t that technically create a race condition because there is now 2 operations (e.g., KV-look, if that does not find anything then insert the document) since after the KV-lookup, maybe the e-mail got added? Alternatively, instead of a lookup, it is to directly insert that smaller document for the e-mail address and see if it fails. This is two operations, which also still opens the door for a race condition?
-
If I need uniqueness across more than one attribute, but there are business logic that prevents me from combining them together like the one posted here2. I don’t really understand how a counter would work for this because it was noted by the OP that the uniqueness is really alias OR loginName.
Thank you.
Regards, Steve