How to insert more than 1000 items at a time through bulkInsert()?

I have a JSON file that contains more than six thousand items. How can I use bulkinsert() to add them to the database??

import wixData from 'wix-data';

let items_to_update = [{},{},{},{},{},{},........., upto 6563]; // JSON Data

wixData.bulkInsert("Try", items_to_update )
.then(response => {
.catch(err = > {

Currently, wixData API doesn’t allow more than 1000 items to update or insert through bulkInsert() or bulkUpdate(). Hence, I was thinking if there any way using LOOPS and PROMISES, we can update more than 1000 items.

break up your items into batches (array) of 1000 each and perform a bulkinsert on each batch (array)

I thought of that but I get confused house to use promises since I have to bulkinsert after one batch is already inserted. The combination of loop and promises confused me.

@rinshulgoel Perhaps this could also be interesting?

@russian-dima I will surely test and reply soon

This is the way the issue can be solved easily -

importwixData from'wix-data';

let items_to_update =[{},{},{},{},{},{},........., upto 6563];// JSON Data


async function insertItems(data){
               int a, b, temp_array,chunk = 1000;
                for (a=0,b=data.length; a<b; a+=chunk) {
                               temp_array = data.slice(a,a+chunk);
                               await wixData.bulkInsert("DatasetName", temp_array);