P
Prisma•3w ago
bockster6669

is there a `substring` method in prisma?

is there a substring method in prisma?
5 Replies
RaphaelEtim
RaphaelEtim•3w ago
Hi @bockster6669 👋 Prisma Client does not have a substring method. However, you can achieve similar functionality using the contains, startsWith, and endsWith filters for string fields. These filters allow you to search for substrings within a string. https://www.prisma.io/docs/orm/prisma-client/queries/filtering-and-sorting#filter-conditions-and-operators
Filtering and Sorting (Concepts) | Prisma Documentation
Use Prisma Client API to filter records by any combination of fields or related record fields, and/or sort query results.
bockster6669
bockster6669•3w ago
I just want to take the first 50 characters of a sentance
RaphaelEtim
RaphaelEtim•3w ago
Prisma does not have a method to directly take the first 50 characters of a string field. However, you can achieve this by fetching the data and then manipulating the string in your application code.
bockster6669
bockster6669•3w ago
yea I know, this doens't fix the bigger network traffic
Eli S
Eli S•3w ago
You can do a raw SQL query, if it's a SQL db. I think the typed SQL stuff might make that easier
Want results from more Discord servers?
Add your server