Not holding much hope of an answer due to previous experience on here but here goes:
I require many rows to be added to a collection at once, an average of 1500 a time.
If i was using a proper platform i would generate a large object and then insert all rows with one query.
so instead I loop the number of rows i need in a for each and insert with an await wix data insert. This is working up to around 500 or so rows where the system just stops reporting and nothing seems to be happening! checking the collection shows max 650 rows out of 1500!
does anyone please have any Ideas?
I do not have the time to write, yet another, function that checks how many and where the function failed and then re attempt to insert the failed rows. This will be extremely difficult as the data used to generate these rows could potentially be gone…
@avillarg using it is not more difficult than looping though the records and inserting them one by one, and it works better.
You can try writing the code, and if it doesn’t work, post your code here and get feedback.
@avillarg No. You put each record in an object, you push each object to an array and then you run bulkInsert on the array.
I may be able to help more if you add details regarding the data you have and its structure and how did you planned to insert it. But as of now your questions are pretty general…
//for (var i = 0; i < 50; i++) for ( var i = 0; i < AllInfo.length; i++)
{
let toInsert =
{
“idCliente”: i,
//“idCliente”: AllInfo[i].IdCliente,
“nombreCliente”: AllInfo[i].NombreCliente,
“entradaNo”: AllInfo[i].EntradaNo,
“mp_esp”: AllInfo[i].MP_Esp
};
I am lost at the field “idCliente”, is this a custom field or an autogenerated field? I am sorry if this sounds simple but is this the same as “owner”?
No, it´s got nothing to do with it. The “idCliente” is just a field name (also called “key” in Wix Data Manager) in a collection called (generically) myCollection. So if you have a collection where the client ID is called “clientId”, then you should use “clientId” in this array of objects before you bulk-insert them to the collection.
I have used several times the wixData . bulkInsert without problems, but now, when I try to import about 3000 registers it doesn’t work, There is a limit to use it?