- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
我想分配一个模型字段来存储 MongoDB 中的 Long 整数类型。我已经用 BigIntegerField 试过了,但它仍然作为 Integer 字段保存在 MongoDB 中。我试过使用:
models.BigIntegerField()
我应该使用哪个模型字段?注意:我将 django-nonrel 用于 DJango-MongoDB 关系。
最佳答案
您是否节省了足够大的值(value)?您使用的 python 版本也可能很重要。来自 API 文档:
A Python int will be saved as a BSON int32 or BSON int64 depending on its size. A BSON int32 will always decode to a Python int. In Python 2.x a BSON int64 will always decode to a Python long. In Python 3.x a BSON int64 will decode to a Python int since there is no longer a long type.
此外,python long 应始终映射到 BSON 64 位整数:
关于Django:用于 MongoDB 的长字段 (BigIntegerField),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12138412/
我想分配一个模型字段来存储 MongoDB 中的 Long 整数类型。我已经用 BigIntegerField 试过了,但它仍然作为 Integer 字段保存在 MongoDB 中。我试过使用: mo
我有一个具有以下属性的模型 from django.db import models class ApiLogs(models.Model): user_id = models.BigInte
我是一名优秀的程序员,十分优秀!