title: How to properly use ON DUPLICATE KEY UPDATE in Node.js MySQL
body: <p>I'm using <strong>Node.js</strong> to push values to a MySQL table like:</p>
  
  <pre><code>     for (var i = 0; i &lt; data.length; i++) {
          flattenedData.push([data[i].id, data[i].adult, data[i].backdrop_path, JSON.stringify(data[i].genre_ids), data[i].original_language, data[i].original_title, data[i].overview, data[i].popularity, data[i].poster_path, data[i].release_date, data[i].title, data[i].video, data[i].vote_average, data[i].vote_count]);
          //console.log(flattenedData);
        }                                                      
        db.query("INSERT INTO movies (id, adult, backdrop_path, genre_ids,  original_language, original_title, overview, popularity, poster_path, release_date, title, video, vote_average, vote_count ) values ?", [flattenedData], function (err, result) {
          if (err) {
            throw err;
          }
          else {
            console.log('data inserted' + result);
          }
       });
  </code></pre>
  
  <p>I want to add <code>ON DUPLICATE KEY UPDATE</code> to the query, but I keep getting syntax errors, can anyone show me the proper way?</p>