Prisma: Prisma, how to reverse order

Join the AI Workshop to learn more about AI and how it can be applied to web development. Next cohort February 1st, 2026

The AI-first Web Development BOOTCAMP cohort starts February 24th, 2026. 10 weeks of intensive training and hands-on projects.


I was getting data from the database using Prisma.

In my specific case I was getting tweets from the Tweets table, and they were listed from oldest to newest.

I wanted the opposite, like Twitter works - the newest shows up first.

So I picked my data fetching procedure:

await prisma.tweet.findMany({})

and I added an orderBy attribute to order by id in descending order:

await prisma.tweet.findMany({
  orderBy: [
    {
      id: 'desc'
    }
  ]
})

Lessons in this unit:

0: Introduction
1: How to use Prisma
2: Prisma relations
3: Using multiple fields for a unique key in Prisma
4: ▶︎ Prisma, how to reverse order
5: Prisma, how to clear the database
6: How to solve the `prisma/client did not initialize yet` error on Vercel