nikolasburk
orderBy
object can now have as many fields as you want! The order of the fields hereby determines the order of the returned list (see example below).
You can use it like so:
// order by `age` descending and then by `name` ascending
const users = await prisma.user.findMany({
orderBy: {
age: 'desc',
name: 'asc'
}
})
As mentioned by the comment, the returned objects in users
are ordered first by age
(descending), and then by name
(ascending).
💰 Introduced $
dollar prefix for top-level Prisma Client methods
In recent versions, we introduced a couple of top-level methods in Prisma Client (e.g. prisma.transaction()
and prisma.use()
) in preview mode. The immediate feedback was that the denylist for model names grew - which breaks Prisma schemas where a model is called Transaction
, transaction
, use
, or Use
. And the list goes on...
In order to have a future-proof API, that allows maximum expressibility in terms of model names, we decided to prefix all non-query methods with a dollar sign $
. That means Prisma Client will from now on ship with the following methods:
Pre-existing:
- $disconnect
- $connect
- $on
- $queryRaw
- $executeRaw
Still in preview:
- $use
- $transaction
The preview methods have already been renamed, the pre-existing methods like connect
are still available, you just get a deprecation warning. They will be available for a few more releases with an alias, so no hurry to update them yet.
🖥️ Updates in Prisma Studio
With this release, we shipped a number of improvements and changes for Prisma Studio:
• Refreshed design
• Moved the Reload button from the right of the databrowser to the left
• Moved the Pending Actions bar from the bottom of the databrowser to the top right
• Removed the sidebar; to open a model, you can now press the New Tab button on the top
• Removed the code editor
• Removed the tree view
• Added ability to view and edit JSON fields
Try out Prisma Studio in the online demo or in your Prisma project by running:
npx prisma studio --experimental
👀 Preview features
Just a quick reminder that we currently have the following preview features:
• connectOrCreate
• transactionApi
• aggregateApi
• distinct
• middlewares
In case they're useful for you, please give them a try and share your feedback! These features remain in preview in this release.
📚 Learn more in the release notes
For more info and links to documentation, you can read the release notes.
🌟 Help us spread the word about Prisma 🌟
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.