Nathan Stanford
Nathan Stanford

Reputation: 1394

Fixing the deprecated issue with Sequelize and nodejs

enter image description here

Can someone tell me what I need to do to fix the deprecated issue displayed in the image below? What do I need to do for this?

    var Sequelize = require("sequelize");

    var connection = new Sequelize('databaseschemaname','nodejs','replacewithpassword', {host: 'localhost', dialect: 'mysql'
 operatorsAliases: false,
});

    const Op = Sequelize.Op;

    var Article = connection.define('article', {
      title: Sequelize.STRING,
      body: Sequelize.TEXT
    });


    connection.sync().then(function () {
      Article.findAll().then(function(articles) {
        console.log(articles.length);
      })
    });

Upvotes: 2

Views: 2925

Answers (1)

gb_spectrum
gb_spectrum

Reputation: 2301

You can find more info at this link:

http://docs.sequelizejs.com/manual/tutorial/querying.html

Then scroll down to "Operators security".

There are a few ways to deal with this issue. If you just want to get rid of the message, basically you can add the following to your connection: { operatorsAliases: false }

I don't know what your connection query looks like, but it could look something like this:

const Sequelize = require('sequelize');
const connection = new Sequelize(db, user, pass, { 
    operatorsAliases: false 
});

Upvotes: 2

Related Questions