Hello there! Is there a way to cut a queried field...
# random
s
Hello there! Is there a way to cut a queried field to a certain length? Say, I have a
text
field in my
Post
type. I do not want to get a full text from
text
field, only first 150 symbols.
w
Don’t think it’s possible using prisma query engine. Although you can still easily process your data yourself after it’s queried, lodash has a
_.truncate()
function to do that. Not sure how much data you’re querying though, it’s might not be that efficient 😕
Another solution is just to
truncate()
your data when it’s being pushed so you don’t have to process it every time you query it after
Or just prevent users from inputing more than 150 chars 🙄
s
Thank you @weakky. Do you know, perhaps, how to run raw SQL queries against Prisma DB?
a
@sakhmedbayev Checkout this tutorial:

https://www.youtube.com/watch?v=YUjlBuI8xsU

👍 3
s
Thank you @alechp. It is very helpful!