I have a USER collection which stores user information. Every item will these 3 fields:


If in the future I need to make this collection available across different regions I understand there are 5 different consistency levels (strong, bounded staleness, session, consistent prefix, and eventual consistency). If I want to guarantee that two users in two different regions do not create the same user (with either the same userid or username or email) at the same time is my only option then strong consistency? A followup question, if I set this collection to be strong, do all my other collections also have to be strong or can I set the consistency level of different collections to different levels (For e.g USER collection is strong and POSTS are eventual)?


Multi-master can only be configured to have a weaker consistency than strong. So, CosmosDB cannot stop two different regions create the same user concurrently but it gives you the ability to do conflict resolution When such a conflict occurs, you can resolve the conflict by using different conflict resolution policies.

您可以随时在Azure Cosmos帐户上配置默认一致性级别。在您的帐户上配置的默认一致性级别适用于该帐户下的所有Azure Cosmos数据库和容器。默认情况下,对容器或数据库发出的所有读取和查询都使用指定的一致性级别。