Hey <!everyone> :v::prisma-cool: We just released...
# prisma-whats-new
d
Hey <!everyone> ✌️prisma cool We just released Prisma 2.21.0 prisma rainbow This version includes many bug fixes, improved error messages, and a new preview feature. 📇 Order by an aggregate in groupBy is now in Preview Let’s say you want to group your users by the city they live in and then order the results by the cities with the most users. In
2.21.0
, now you can!
Copy code
const userRatingsCount = await prisma.user.groupBy({
  by: ['city'],
  count: {
    city: true,
  },
  orderBy: {
    _count: {
      city: 'desc',
    },
  },
})
The query returns the following:
Copy code
[
  { city: 'Berlin', count: { city: 3 } },
  { city: 'Paris', count: { city: 2 } },
  { city: 'Amsterdam', count: { city: 1 } },
]
Enable this feature with the
orderByAggregateGroup
preview flag:
Copy code
generator client {
  provider        = "prisma-client-js"
  previewFeatures = ["orderByAggregateGroup"]
}
📚 Learn more in the release notes For more info and links to documentation, you can read the release notes. 🚢 The next 2.22.0 release will be postponed by a week We release Prisma normally every two weeks. The next
2.22.0
release will be postponed by a week and happen on May 5, 2021. 🌳 Help us spread the word about Prisma and we’ll donate trees  🌳 To help spread the word about Prisma, we’d very much appreciate if you would star the repo 🌟 And if you’re excited about the features in this week’s release, then help us and share your excitement on Twitter. Quick reminder that for every tweet tagging Prisma in the month of April, we’ll be donating a tree as part of Tweets for Trees . 📺 Join us on Thursday for the “What’s new in Prisma” livestream This week, my colleague @ryan and I will discuss the latest release and other news from the Prisma ecosystem in a 

livestream on YouTube

 on Thursday at 5pm Berlin | 8am San Francisco. 🙏 Big thanks to all the external contributors who helped with this release!
💚 16
prisma rainbow 31
🚀 22
👏 12
prisma cool 7
🇰🇷 13
🇦🇱 3
🇮🇳 7
fast parrot 8
rage4 2
🇷🇺 1
pakistan parrot 1
🇻🇪 1
🌍 8
germany parrot 6
🔝 6
sweden parrot 3
💯 27
👏🏾 1
🇧🇷 3
🇳🇬 5
🇨🇴 1
🇹🇷 1
🇵🇱 9
prisma orange 13
🇨🇵 7
🎉 14
🇨🇺 3
prisma green 8
🇽🇰 3
🇳🇴 3
👏🏻 1
🏳️‍🌈 2
🇲🇦 1
🇬🇧 2