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

114
Vistas
Node js search on prisma for string with case insensitivity

I want to find the user with a specific email regardless case sensitivity of the email in the DB or in the request body. Using any of the following methods is rendering an undefined function error

    const user = await prisma.User.findUnique({
        where: {
            email: {
                insensitive: {
                    equals: req.body.email,
                },
            }
        }
    })

    const user = await prisma.User.findUnique({
        where: {
            email: {
                insensitiveEquals: req.body.email
            }
        }
    })

    const user = await prisma.User.findUnique({
        where: {
            email: req.body.email,
            mode: 'insensitive'
        }
    })
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Undefined function error would mean that there is no function findUnique available on the user model. This would happen if PrismaClient is not up to date with the schema file. You would need to execute npx prisma generate to generate the latest PrismaClient.

After generating PrismaClient following query can be used to find user with email in case insensitive mode.

  const user = await prisma.user.findMany({
    where: {
      email: {
        equals: 'test@test.com',
        mode: 'insensitive',
      },
    },
  });

This reference of case insensitive filtering will be helpful as well.

about 4 years ago · Juan Pablo Isaza Denunciar
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