I did an introspection of a MongoDB from Prisma using the command ‘prisma db pull’. This detected all number fields as integers (both long and int) and created the following entry in prisma.schema:
Index Int // Here I search for something like 'Int32'
To enable compatibility with 32bit applications I am currently looking for a way to explicitly declare the Int fields as 32bit integers – so far without success. No schema or similar is used in the database yet.
The datatypes for numeric datatypes in MongoDB with Prisma are described here
Does anyone know a way to declare this explicitly?
Thanks in advance!
2
Answers
In addition to Nurul Sundarani helpful hint, I found some helpful information in Prisma's documentation here.
There is the possibility to explicitly refer to the Int datatype of MongoDB - in schema.prisma this must be entered as follows:
I use Prisma V3.14.0 here link.
Declaring a column as
Int
would by default mean that it’s stored as 32bit integers. If you define a column asBigInt
then those integers would be stored as 64bit integers.Here’s a reference of mapping between Prisma and MongoDB types: Reference