[英]Is there any way to explicitly declare int32 in schema in Prisma for MongoDB?
I did an introspection of a MongoDB from Prisma using the command 'prisma db pull'.我使用命令“prisma db pull”对来自 Prisma 的 MongoDB 进行了自省。 This detected all number fields as integers (both long and int) and created the following entry in prisma.schema:
这将所有数字字段检测为整数(long 和 int)并在 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.为了实现与 32 位应用程序的兼容性,我目前正在寻找一种方法来将 Int 字段显式声明为 32 位整数 - 到目前为止没有成功。 No schema or similar is used in the database yet.
数据库中尚未使用架构或类似架构。
The datatypes for numeric datatypes in MongoDB with Prisma are described here 此处描述了带有 Prisma 的 MongoDB 中数字数据类型的数据类型
Does anyone know a way to declare this explicitly?有谁知道明确声明这一点的方法?
Thanks in advance!提前致谢!
Declaring a column as Int
would by default mean that it's stored as 32bit integers.默认情况下,将列声明为
Int
意味着它存储为 32 位整数。 If you define a column as BigInt
then those integers would be stored as 64bit integers.如果您将列定义为
BigInt
,那么这些整数将存储为 64 位整数。
Here's a reference of mapping between Prisma and MongoDB types: Reference下面是 Prisma 和 MongoDB 类型映射的参考: 参考
In addition to Nurul Sundarani helpful hint , I found some helpful information in Prisma's documentation here .除了 Nurul Sundarani 的有用提示外,我还在此处的 Prisma 文档中找到了一些有用的信息。
There is the possibility to explicitly refer to the Int datatype of MongoDB - in schema.prisma this must be entered as follows:可以明确引用 MongoDB 的 Int 数据类型 - 在 schema.prisma 中,必须按如下方式输入:
Index Int @db.Int // Explicit use of the 32bit integer of MongoDB
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.