I want to implement a simple searching functionality with Prisma
I have seen some info about using the where
clause but it’s case sensitive so it’s not a good solution.
I’ve also seen some tutorials using external services. I don’t want to use any external services. I’d like to do something as simple as possible.
Any way I can tweak the query to be case insensitive? or any other approach you guys recommend?
Thanks :)
Prisma is an ORM that is used inside of GraphQL resolvers to query a database. It works perfectly with all your favorite tools and libraries from the GraphQL ecosystem. You can use it with SDL-first and code-first GraphQL schemas and with any server library such as Apollo Server, Express, NestJS or Mercurius.
I'd recommend making a separate database client to connect to the prisma database not through prisma client, and just do a text search using the standard db client. For example, if you want to use mongodb for prisma, you can just use the mongo client in your resolver to perform a text search
However, as a backend developer, you are still responsible for how your GraphQL server retrieves the requested data from the database by implementing your GraphQL resolvers – that's where Prisma comes in. Prisma is an ORM that is used inside of GraphQL resolvers to query a database.
Map your Prisma schema to the database so you don't need to write SQL to manage your database schema. Prisma Client reduces boilerplates by providing convenient APIs for common database features. At Prisma, we love GraphQL and believe in its bright future.
This feature isn't implemented yet: https://github.com/prisma/prisma1/issues/1183
However, you can have a raw access to your database if it supports this feature: https://www.prisma.io/docs/prisma-graphql-api/reference/raw-database-access-qwe4/#overview
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With