更新时间:2022-11-25 12:01:06
如果存储过程注册的集合是一个单分区集合,那么事务的范围是所有集合中的文档.如果集合是分区的,然后在a的事务范围内执行存储过程单个分区键.然后每个存储过程执行必须包括与范围对应的分区键值事务必须在下运行.
If the collection the stored procedure is registered against is a single-partition collection, then the transaction is scoped to all the documents within the collection. If the collection is partitioned, then stored procedures are executed in the transaction scope of a single partition key. Each stored procedure execution must then include a partition key value corresponding to the scope the transaction must run under.
您可以参考上面提到的描述 这里.
You could refer to the description above which mentioned here.
正如@Rafat Sarosh 所说,GUID Id
不是一个合适的分区键
.根据您的情况,city
可能更合适.您可能需要调整您的数据库partitioning scheme
,因为分区键在定义后无法删除或修改.
As @Rafat Sarosh said, GUID Id
is not an appropriate partitioning key
. Based on your situation , city
may be more appropriate.You may need to adjust your database partitioning scheme
because the partitioning key can not be deleted or modified after you have defined it.
我建议您将数据导出到json
文件然后导入到一个由city 通过 Azure Cosmos DB 数据迁移工具一>.
I suggest you exporting your data to json
file then import to a new collection which is partitioned by city
via Azure Cosmos DB Data migration tool.
希望对你有帮助.
仅供参考:
问题:
执行sql查询文档时无法提供特定的分区键值.
Unable to provide specific partition key value when executing sql to query documents.
解决方案:
1.在执行查询sql时将EnableCrossPartitionQuery
设置为true
.(有性能瓶颈)
1.Set EnableCrossPartitionQuery
to true
when executing query sql.(has performance bottleneck)
2.考虑将经常查询的字段设置为分区键.
2.Consider setting a frequently queried field as a partitioning key.