Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

109
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!