Ibad Shaikh
09/27/2021, 7:45 PM_await prisma.model.count_({
      _select_:_ _{
        _id_: _true_,
        _user_:_ _{
          _select_:_ _{
            _username_: _true_,
_Â Â Â Â Â Â Â Â Â Â _},
_Â Â Â Â Â Â Â Â _},
        _category_:_ _{
          _select_:_ _{
            _name_: _true_,
_Â Â Â Â Â Â Â Â Â Â _},
_Â Â Â Â Â Â Â Â _},
_Â Â Â Â Â Â _})
As we already knew that currently its not possible to use select and include at the same time.
So I came through another approach without using the include keyword and just directly create a nested object on the field you had a relation with like in my case its user and category.
The above query is working fine on .findMany() but it fails on .count().
it throws the error above :
_Unknown field user
for select statement on model PostCountAggregateOutputType. Available options are listed in green. Did you mean user_id
?_Ryan
09/28/2021, 7:27 AMcount
only returns the count for the given model as a number. It cannot return any fields or relations.