Hi guys. I have question about how to find the old...
# orm-help
m
Hi guys. I have question about how to find the oldest One record from my DB?
Copy code
await prisma.posts.findOne({
  where: {oldest(updatedAt)} // ???
})
Thanks for any advice 😉
findFirst
is the way :)
b
Prisma 2.8 just release a new function called
findFirst
. You could do
Copy code
await prisma.posts.findFirst({ orderBy: { createdAt: 'asc' } })
💯 1
🙌 1
You beat me to it