Question

I have a Text model;

class Text(db.Document):
    siphash_value = db.LongField()

Then I use siphash lib for create a hash.(https://github.com/majek/pysiphash)

This lib converts string to long value like 12398370950267227270L

If I try save document to my db;

Text(siphash_value=12398370950267227270L).save()

I get this error:

OverflowError: MongoDB can only handle up to 8-byte ints
Was it helpful?

Solution

MongoDB only supports 64 bit integers (bson.spec) so pymongo can't convert the Long hence the error.

OTHER TIPS

Could you tell us WHY it is working now? The new library is returning a non long field? (I can not comment your own answer because I have less than 50 reputation, sorry all).

I tried to replace LongField by FloatField and it worked. And actually it has the same result. Just had a different notation (1.2398370950267228e+19).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top