I'm not sure what I'm missing, I thought putting Games in brackets would let me do bulk insert to MySQL. However when I do this it comes back as (OBJECT,OBJECT). If I remove the brackets then I only get one single insert but it works! Any suggestions to do bulk insert?
Short sample of the Array
[{title:xxx,link:https://xxxx,description:xxx.,xxx:xxxxx},{title:xxx,link:https://xxxx,description:xxx.,xxx:xxxxx}]
Javascript
// Writing the Games inside a json file
fs.writeFile("feed.json", JSON.stringify(Games), function(err) {
if (err) throw err;
console.log("Saved!");
});
con.connect(function(err) {
if (err) throw err;
console.log("Connected!");
var sqlquery = "INSERT INTO gtable (title, link, description, company) VALUES ?";
let queryData = {
sql: sqlquery,
values: [Games]
}
con.query(queryData, function (err, result) {
if (err) throw err;
console.log("Number of records inserted: " + result.affectedRows);
});
});