Home>

I recently faced the work of the database in Node.

Now I have a problem with the request Sequelize. .

There is a simple code. And there Op.Like. issues not a correct request SQL .

in place % delay% In the request it is shown '\ "% delay% \"' .

Here is a part of the code and response from the server.

const Sequelize= Require ('Sequelize');
Const Op= Sequelize.op;
Const shortcodes= await shortcode.findall ({
      WHERE: {
           Project_id: Project.ID,
             Settings: {
                 [Op.Like]: `% Delay%`
             }
           }
      });

Here SQL Created by this library.

Select
  *
From.
  `Shortcodes` As` shortcode`
Where `shortcode`.`Project_id`= 1
  And `shortcode`.`settings` Like '\"% delay% \ "';

Well, if you find a reference, there are direct quotes in the example, and not reverse. [Op.Like]: '% Delay%'

Akina2021-08-06 04:34:08

@Akina I spent all the types of pitches, the result is the same.

Raz Galstyan2021-08-06 04:34:08

What type of column settings?

nörbörnën2021-08-06 04:34:08

@ Nörbörnën Settings ->Text. Text Type in MySQL.

Raz Galstyan2021-08-05 06:27:44