Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

366
Vistas
What is the proper use of the Op.like operator from sequelize?

Currently trying to use [Op.like] for DB queries based off user input, from what I've read I believe that to be the operator to find DB entries based off the text entered, yet I've realized that in the manner im using it, it's essentially just showing me the 1st entry in the database while not showing anything else. Trying to test with 2 similar entries to make sure it's actually pulling the data accordingly.
Here is my route currently,

router.get('/caseDetail/:caseName', (req,res) => {
    db.caseDetail.findAll({
        
        include : [db.Part,db.Fault,db.Disposition,db.Contact,db.Site],
        where : {
            caseName:{ 
              [Op.like]: [req.params.caseName]}
        }
    }).then((response) => {
        console.log(response);
        res.json(response)
    }).catch((error) => {
        console.log(error);
    })
})

Am I using this wrong? at first I thought I made a huge breakthrough but then through testing it seems that I've missed the mark. Any insight would be greatly appreciated.
Below is what currently exists in the DB enter image description here Here is whats coming back when I hit the [Op.like] operator enter image description here

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda