Good day. There is a certain array.
[ {car: mazda, type: kabriolet, color: red, rider: whore}; {car: BMW, type: sedan, color: black, rider: big boss}; ] Using this array to populate the database, I encounter difficulty. The difficulty is as follows. The table needs properties such as car and rider . But all the properties that return the server. Hence the error, carview table was created only with car and rider columns.
The SQL query looks like this:
var query = connection.query('insert into carview set ?', aboutcar[i], function(err, result) { if (err) { console.error(err); return; } console.error(result); }); It turns out only if I delete the properties of objects that I do not want with the help of the operator delete . But I read on the Habré that such a method causes a leak, and the code becomes healthy because of these delete . I think the answer lies in the use of the INSERT operator. Help guide the true path.