Validation does not work for mysql (nodejs)

Validation does not work for mysql (nodejs)

junsoopablojunsoopablo Posts: 1Questions: 1Answers: 0
edited April 2020 in Free community support

I got a mysql database and tries to validate the input data format using validator function as shown below. However, an error message appears, and failed to validate. I tried other options like numeric, dbValues and so on but they all did not work except notEmpty option. I would appreciate if anyone tell me how to solve this problem.

ERROR: .returning() is not supported by mysql and will not have any effect

let editor = new Editor( db, 'markers','ID')
  .fields(
    new Field( 'ID' ),
    new Field( 'service' ),
    new Field( 'trait' )
      .validator(Validate.notEmpty(new Validate.Options({
        message: "No trait input"
      }))),
    new Field( 'rsid' )
      .validator(Validate.minLen(
        3,
        new Validate.Options({
          message : "No RSID input"
        })
      )),
    new Field( 'effect' )
      .validator(Validate.notEmpty(new Validate.Options({
        message: "No effect input"
      })))
  );
await editor.process(req.body);
res.json(editor.data());

My db.js content is as follows:

let knex = require('knex');

module.exports = knex({
    client: 'mysql', 
    connection: {
        database:    'abc',
        host:        '1.1.1.1',
        password:    'password',
        user:        'user',
        dateStrings: true
    }
});

Answers

  • colincolin Posts: 15,143Questions: 1Answers: 2,586

    Can you give more information, please, such as what the error actually is. Are you able to link to your page so we can take a look?

    Colin

This discussion has been closed.