TypeError: Path must be a string

0

This error appears to me when I try to do UPDATE in my MySQL DB. The error only appears on this page, in the other one that also does UPDATE (different tables) not from any error.

TypeError: Path must be a string. Received { id_ponto: '3',
  id_func: '35',
  nome: 'ROGER ANDRETTO',
  data_ponto: '2018-07-06T03:00:00.000Z',
  feriado: 'SIM',
  entPri: '05:15',
  saiPri: '09:59',
  entSeg: '05:19',
  saiSeg: '05:59' }

The code to send the data to the API that does the update:

app.post('/edit_ponto/update', function(req, res){
    var ponto = req.body

    var connection  = app.config.dbConnection();
    var models = app.app.models.update;

    models.updatePonto(ponto, connection, function(error, result){
        res.render(ponto)
    });
})

The API:

this.updatePonto = function(ponto, connection, callback){
        connection.query('UPDATE pontos SET ? WHERE id_ponto = ?', [ponto, ponto.id_ponto], callback);
    };
    
asked by anonymous 26.07.2018 / 20:12

0 answers