Replies: 1 comment 1 reply
-
Hi @skelawsky 👋 In Prisma, you can use operators like gt (greater than) and lt (less than) to filter data. However, these operators are typically used with numerical values, not with a string search. For example, you can use const getPosts = await prisma.post.findMany({
where: {
likes: {
gte: 9,
},
},
}) For string searches, Prisma provides the contains, startsWith, and endsWith operators. For example, you can use 'contains' to find all posts where the title contains a certain string: const result = await prisma.post.count({
where: {
content: {
contains: 'databases',
},
},
}) If you want to perform a full-text search, Prisma also supports that feature for PostgreSQL and MySQL databases. You can use the // All posts that contain the word 'cat'.
const result = await prisma.posts.findMany({
where: {
body: {
search: 'cat',
},
},
}) If this answers your question, it would be great if you could mark this Discussion as answered to indicate that it has been resolved. Otherwise please let us know how else we can help you further or close the Discussion if it was resolved in some other way 🙏 |
Beta Was this translation helpful? Give feedback.
-
Do I need to write my own parser for this or did I miss something in the documentation? I can't find info about it.
Beta Was this translation helpful? Give feedback.
All reactions