Hey folks. Is this not allowed? ```const count = a...
# orm-help
r
Hey folks. Is this not allowed?
Copy code
const count = await db.recipe.count({ where, distinct })
It passes type check but gives me an error
Copy code
Error: Unknown arg `distinct` in distinct for type AggregateRecipe. Did you mean `select`?
I have a function that optionally takes a
distinct
param for instance to select only 1 recipe per author (
distinct: 'authorId'
) The function is paginated so I'd like to know how many total recipes (distinct by authorId) there are in that case!
r
@Robert 👋 Unfortunately a distinct count is not possible in this case. It would be great if you could open a feature request here for the same so that we can look into this 🙂
As a workaround, you can use
distinct
and
where
in
findMany
and return the length of the items that you found.
r
Sure thing I'll open a feature request!
💯 1
Thanks!
👍 1