but when I try to use differents string in the fir...
# prisma-client
g
but when I try to use differents string in the firstName and lastname is correct the function
✅ 1
n
Hi Guillermo 👋 Which database are you using and which Prisma version?
g
My database is MySql and prisma is 3.11.1
n
Okay, let me try to reproduce on my end and I’ll get back to you.
I tested the below query and it works as expected for me on version 3.11.1 schema.prisma
Copy code
generator client {
  provider = "prisma-client-js"
}

datasource db {
  provider = "mysql"
  url      = env("DATABASE_URL")
}

model User {
  id        String   @id @default(cuid())
  firstName String
  lastName  String
  email     String
  createdAt DateTime @default(now())
  updatedAt DateTime @updatedAt
}
index.ts
Copy code
import { PrismaClient } from '@prisma/client';

const prisma = new PrismaClient({
  log: ['query'],
});

async function main() {
  //Create User
  const id = 'cl70bpt2s000009mp9a3j3shf';

  const createUser = await prisma.user.create({
    data: {
      email: '<mailto:test@test.com|test@test.com>',
      firstName: 'John',
      lastName: 'John',
      createdAt: new Date(),
      id: id,
    },
  });

  const findUser = await prisma.user.findFirst({
    where: {
      firstName: 'John',
      lastName: 'John',
    },
  });

  console.log(findUser);
}

main()
  .catch((e) => {
    throw e;
  })
  .finally(async () => {
    await prisma.$disconnect();
  });
Response:
Copy code
> ts-node index.ts

prisma:query BEGIN
prisma:query INSERT INTO `railway`.`User` (`id`,`firstName`,`lastName`,`email`,`createdAt`,`updatedAt`) VALUES (?,?,?,?,?,?)
prisma:query SELECT `railway`.`User`.`id`, `railway`.`User`.`firstName`, `railway`.`User`.`lastName`, `railway`.`User`.`email`, `railway`.`User`.`createdAt`, `railway`.`User`.`updatedAt` FROM `railway`.`User` WHERE `railway`.`User`.`id` = ? LIMIT ? OFFSET ?
prisma:query COMMIT
prisma:query SELECT `railway`.`User`.`id`, `railway`.`User`.`firstName`, `railway`.`User`.`lastName`, `railway`.`User`.`email`, `railway`.`User`.`createdAt`, `railway`.`User`.`updatedAt` FROM `railway`.`User` WHERE (`railway`.`User`.`firstName` = ? AND `railway`.`User`.`lastName` = ?) LIMIT ? OFFSET ?
{
  id: 'cl70bpt2s000009mp9a3j3shf',
  firstName: 'John',
  lastName: 'John',
  email: '<mailto:test@test.com|test@test.com>',
  createdAt: 2022-08-19T10:44:07.985Z,
  updatedAt: 2022-08-19T10:44:09.985Z
}
Could you share a minimal reproduction of the error?
Here’s a working example with fulltextsearch Please have a look at the User model in schema file schema
Copy code
generator client {
  provider        = "prisma-client-js"
  previewFeatures = ["fullTextIndex", "fullTextSearch"]
}

datasource db {
  provider = "mysql"
  url      = env("DATABASE_URL")
}

model User {
  id        Int    @id @default(autoincrement())
  firstName String @db.VarChar(255)
  lastName  String @db.VarChar(255)

  @@fulltext([firstName])
  @@fulltext([lastName])
}
index.ts
Copy code
import { PrismaClient } from '@prisma/client';

const prisma = new PrismaClient({
  log: ['query'],
});

async function main() {
  await prisma.user.create({
    data: {
      firstName: 'John',
      lastName: 'Doe',
    },
  });

  const response = await prisma.user.findFirst({
    where: {
      firstName: {
        search: 'John',
      },
      lastName: {
        search: 'Doe',
      },
    },
  });

  console.log(response);
}

main()
  .catch((e) => {
    throw e;
  })
  .finally(async () => {
    await prisma.$disconnect();
  });
Response:
Copy code
➜ npm run dev       

> hello-prisma@1.0.0 dev
> ts-node index.ts

prisma:query SELECT `prisma`.`User`.`id`, `prisma`.`User`.`firstName`, `prisma`.`User`.`lastName` FROM `prisma`.`User` WHERE (MATCH (`prisma`.`User`.`firstName`)AGAINST (? IN BOOLEAN MODE) AND MATCH (`prisma`.`User`.`lastName`)AGAINST (? IN BOOLEAN MODE)) LIMIT ? OFFSET ?

{ id: 1, firstName: 'John', lastName: 'Doe' }