小编var*_*hak的帖子

使用存储过程的Azure documentdb批量插入

嗨我正在使用16个集合来插入大约3-4百万个json对象,范围从每个对象5-10k.我使用存储过程来插入这些文件.我有22个容量单位.

function bulkImport(docs) {
    var collection = getContext().getCollection();
    var collectionLink = collection.getSelfLink();

    // The count of imported docs, also used as current doc index.
    var count = 0;

    // Validate input.
    if (!docs) throw new Error("The array is undefined or null.");

    var docsLength = docs.length;
    if (docsLength == 0) {
        getContext().getResponse().setBody(0);
    }

    // Call the CRUD API to create a document.
    tryCreateOrUpdate(docs[count], callback);

    // Note that there are 2 exit conditions:
    // 1) The createDocument request was not accepted. 
    // …
Run Code Online (Sandbox Code Playgroud)

bulkinsert azure azure-cosmosdb

7
推荐指数
2
解决办法
6712
查看次数

标签 统计

azure ×1

azure-cosmosdb ×1

bulkinsert ×1