How to Handle Case Insensitivity?

This is giving me an error with findFirst.
3 Replies
Wolverine
Wolverine3mo ago
//Fetch a book by name, handling non-existence
async getBook(name) {
try {
return await prisma.book.findFirst({
where: {
title: {
equals: name,
mode: 'insensitive'
}
}
});
} catch (error) {
console.error("Error in getBook: ", error)
return { error };
}
}
//Fetch a book by name, handling non-existence
async getBook(name) {
try {
return await prisma.book.findFirst({
where: {
title: {
equals: name,
mode: 'insensitive'
}
}
});
} catch (error) {
console.error("Error in getBook: ", error)
return { error };
}
}
Unknown argument mode. Did you mean lte? Available options are marked with ?. I am using sqllite. Online says that sqlite handles case insensitivity by default. But if I remove mode, case insensitivity does matter. If I add mode, I get an error. findFirst does not work with mode maybe? But why if so?
David
David3mo ago
No description
Want results from more Discord servers?
Add your server
More Posts
Inconsistent query result: Field topics is required to return data, got `null` instead.All data exists in the db but this still happens. ``` where: {id}, include: { aDoes Prisma Studio work without Node (i.e. with Bun)I've got an environment where Node is not installed. I'm currently running the entire project with BHow to run safe migrationshello guys I am new to Backend. i am using prisma. and I have a hairstyle table containing hairstylPrisma Warn Console in developmentI have encountered the following warning message: prisma:warn. Despite searching extensively in the Type 'string[]' is not assignable to type 'string'.ts(2322) when trying to create a form using Prismso I'm trying to create a submitForm using prisma, react-hook-form and zod and mysql as my database.Strange @relation fields in auto-generated modelsUsing `prisma@5.13.0`, I ran `npx prisma db pull` to generate models for an existing SQLite databaseI feel this is simple but I fear i've just been at it too long I'm starting to not see straight.I have a parent record with a many to many relationship with a child, such as: ```js model User { findMany query is failing as it's breaching planetscale's 100k limit but rawquery is working fineIs findMany fetch all records before it applies distinct condition? await prisma.table.findMany({ Pulse listening to all schemas in my RDS instanceI want pulse to only subscribe to changes within one schema but it gives me changes of all schema, iHow to avoid resetting the DB when switching between branches with schema diffsHello, We are a small team of 4 working with prisma every day, and we often have to switch to the b