skip to Main Content

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


  1. Chosen as BEST ANSWER

    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:

    Index                       Int @db.Int // Explicit use of the 32bit integer of MongoDB
    

    I use Prisma V3.14.0 here link.


  2. Declaring a column as Int would by default mean that it’s stored as 32bit integers. If you define a column as BigInt then those integers would be stored as 64bit integers.

    Here’s a reference of mapping between Prisma and MongoDB types: Reference

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search