Hey all :wave::skin-tone-6: I have two questions ...
# orm-help
e
Hey all ๐Ÿ‘‹๐Ÿฟ I have two questions ๐Ÿ™‹๐Ÿฟโ€โ™‚๏ธ 1. Is there a way to use field count
_.count: { select: {...} }
with a filter like you can in
prisma.x.count()
? this is to allow ignoring records marked as deleted in the count for example 2. Has anyone else experienced an issue with using field count in combination with a filter on a relation in
findMany
e.g. get me all of the posts for a specific user but also but also give me a count of
x
field? - this causes a really slow query for me averaging about 25s and removing the user filter OR the
_.count
gets the time taken back down to ~1s? (using mongo connecter btw)
Number 2 took me down a rabbit hole of trying to add indexes to the DB which did not improve performance at all
t
#1 isnโ€™t possible. You have to use the actual count function.
e
Ok cool thanks! @Tyler Bell