Skip to main content

Fields & types

This section covers various special fields and types you can use with Prisma Client.

Working with Decimal

Decimal fields are represented by the Decimal.js library. The following example demonstrates how to import and use Prisma.Decimal:

import { PrismaClient, Prisma } from '@prisma/client'

const newTypes = await prisma.sample.create({
data: {
cost: new Prisma.Decimal(24.454545),
},
})

You can also perform arithmetic operations:

import { PrismaClient, Prisma } from '@prisma/client'

const newTypes = await prisma.sample.create({
data: {
cost: new Prisma.Decimal(24.454545).plus(1),
},
})

Prisma.Decimal uses Decimal.js, see Decimal.js docs to learn more.

warning

The use of the Decimal field is not currently supported in MongoDB.

Working with BigInt