Open zacronos opened 3 months ago
With drizzle-orm/d1
the object (entity) or undefined
is returned, so doing what you exepcted.
I came here as was wondering if it's possible to return null
instead of undefined
or whether it is possible to extend drizzle so I can add a findFirstOrNull
method?
What version of
drizzle-orm
are you using?0.30.7
What version of
drizzle-kit
are you using?--
Describe the Bug
The
findFirst()
query method returns an array.Example code (I assume the table definition is irrelevant here):
With logging turned on, a query that finds an entity shows:
A query that does not find an entity shows:
Expected behavior
I expect to get an entity (in the "found" case) or
undefined
(in the "not found case"), as indicated in the return type for findFirst() (see the return type for findMany() for contrast), and as documented for findFirst() (documentation for findMany() for constast).Environment & setup
I'm using aws-data-api/pg, not sure if the bug is specific to that client/db