Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

111
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda