且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Cosmos DB-具有自定义分区键的批量导入(单个分区集合)

更新时间:2023-02-14 11:31:56

如果您将批量导入"与迁移工具一起使用,则分区键设置不仅适用于收集方案.请参阅以下

If you use Bulk import with migration tool, the partition key setting is for more than collection scenario.Please see the statement in this link:

当您导入多个集合时,导入工具支持 基于散列的分片.在这种情况下,指定文档属性 您希望用作分区密钥. (如果分区键留为空白, 文档在目标集合中随机分片.)

When you import to more than one collection, the import tool supports hash-based sharding. In this scenario, specify the document property you wish to use as the Partition Key. (If Partition Key is left blank, documents are sharded randomly across the target collections.)

回到您的要求,您可以使用顺序记录导入.

Back to your requirement,you could use Sequential Record Import.

您需要先创建集合并将分区键设置为/item/vid.

You need to create collection first and set the partition key as /item/vid.

我的测试json文件:

My test json file:

结果:

Result: