Filter on count of relations #23949
Labels
kind/feature
A request for a new feature.
team/client
Issue for team Client.
topic: _count
https://www.prisma.io/docs/concepts/components/prisma-client/aggregation-grouping-summarizing#count-
topic: filteredRelationCount
topic: relations
Problem
Lets image the following models
Now saying if l am trying to show the following: Give me all users who have greater than 50 followers
I want to be able to do this in a single
findMany
querySuggested solution
This is the type of query l would want to run:
Alternatives
I have looked at the
groupBy
andaggregate
methods, but none allow me to achieve what l want above.Annoyling l have had to use
rawSQL
which means l need to fully implement the wholetake
/include
/where
functionality by hand, so this would be a big bonus to that.Additional context
These type of filters / filtering are extremely common, and it would be great if
prisma
supported such features.The text was updated successfully, but these errors were encountered: