Hey <!everyone> :v: :prisma-cool: We just release...
# prisma-whats-new
n
Hey <!everyone> ✌️ prisma cool We just released Prisma 2.20.0 prisma rainbow 7️⃣ Count on relations (Preview) This highly requested feature is now in Preview. You can now count the number of related records by passing 
_count
 to the 
select
 or 
include
 options and then specifying which relation counts should be included in the resulting objects via another 
select
. For example, counting the number of posts that an user has written:
Copy code
const users = await prisma.user.findMany({
  include: {
    _count: {
      select: { posts: true },
    },
  },
})
The structure of the returned 
User
 objects is as follows:
Copy code
{
  id: 1,
  email: '<mailto:alice@prisma.io|alice@prisma.io>',
  name: 'Alice',
  _count: { posts: 2 }
}
You can enable this feature with the 
selectRelationCount
 feature flag:
Copy code
generator client {
  provider        = "prisma-client-js"
  previewFeatures = ["selectRelationCount"]
}
There may be some rough edges during the Preview period. If you run into any problems, you can reach us in this issue. ️ Reducing the communication overhead between the Node.js and Rust layers with N-API (Preview) N-API is a new technique for binding Prisma's Rust-based query engine directly to Prisma Client. This reduces the communication overhead between the Node.js and Rust layers when resolving Prisma Client's database queries. You can enable this feature with the 
napi
 feature flag:
Copy code
generator client {
  provider        = "prisma-client-js"
  previewFeatures = ["napi"]
}
Enabling the N-API will not affect your workflows in any way, the experience of using Prisma will remain exactly the same. The N-API has different runtime characteristics than the current communication layer between Node.js and Rust. These are likely (but not certain) to result in a positive effect on the performance of your application. There may be some rough edges during the Preview period. If you run into any problems, you can reach us in this issue. 🐘 New 
push
 operation available for arrays on PostgreSQL
PostgreSQL supports array data structures (sometimes also called scalar lists). As an example, consider the 
permissions
 field on the following 
User
 model:
Copy code
model User {
  id          Int @id @default(autoincrement())
  permissions String[]
}
As of this release, you can append a new item to existing lists atomically with the 
push
 command:
Copy code
await prisma.user.update({
  where: { id: 42 },
  data: {
    permission: {
      push: "chat:read",
    },
  },
})
Learn more in this issue. 🚀 
groupBy
 and 
createMany
 are now Generally Available
For the pioneers among you, you can now remove the 
groupBy
 and 
createMany
 from your Preview features:
Copy code
generator client {
   provider        = "prisma-client-js"
   previewFeatures = ["groupBy", "createMany"] // can be removed now
 }
🦦 Prisma Client Go now supports 
BigInt
Decimal
 and 
Bytes
Prisma Client Go continues to get more powerful every release. With this release, we've added support for more native database types: 
BigInt
Decimal
 and `Bytes`:
Copy code
var views db.BigInt = 1
bytes := []byte("abc")
dec := decimal.NewFromFloat(1.23456789)
created, err := client.User.CreateOne(
  db.User.Picture.Set(bytes),
  db.User.Balance.Set(dec),
  db.User.Views.Set(views),
).Exec(ctx)
💯 8
😍 4
🇺🇦 3
👍 9
❤️ 7
🇮🇱 2
prisma rainbow 10
🦜 5
🔥 4