Hello everybody
I have this code to insert several record in my collection
It is working but if i have a have lot of day to insert, it is really long.
What is the best solution ?
while (deb<=fin) { let toinsert={ "title": "", "_id": id, "refproduit": $w("#dataset4").getCurrentItem()._id , "aeroport": $w("#aeroport").value, "date": deb, "tarifadulte": $w("#tarifadulte").value, "tarifenfant": $w("#tarifenfant").value, "tarifbb": $w("#tarifbb").value, "tarifsingle": $w("#tarifsingle").value }; wixData.insert("TarifsProduits",toinsert) .then( (results) => { let item = results; } ) .catch( (err) => { let errorMsg = err; } ); deb=deb.addDays(1); x++ id=$w("#dataset4").getCurrentItem()._id+x }
Yes, the limit is 1000 per function call.
Hello but i can i lot of record
Beetwen one to 365 (1 year)...
Have a look at bulkInsert. You would have to redesign your code so that the loop loads an array of objects, but you would be making only one call to the server.