[Django]-Django: Long field (BigIntegerField) For MongoDB

1👍

Are you saving a large enough value? It may also matter what version of python you are using. From the API docs:

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.

Also, a python long should always map to a BSON 64-bit integer:

http://api.mongodb.org/python/2.3rc1/api/bson/son.html

Leave a comment