I have a array of data something like
var records = [
{Name: '', Id: 1},
{Name: '', Id: 2},
{Name: '', Id: 3},
{Name: '', Id: 4},
{Name: '', Id: 5},
{Name: '', Id: 6}
];
there could be thousands of items inside records array...
Ques1: Can we create a stored procedure which will accept an array of objects in mysql?
Ques2: Is there a way to bulk insert this data into mysql with Node JS?
You can bulk insert the array of records ,but before that you might need to convert it into array of arrays
I use array reduce to get an array something like this
This will output
Now inserting into the mysql database
so the format of multiple data insert should be like
[[[a,b],[b,c],[d,k]]]