I’ve run into problem when testing insert into mondgodb python object
which was extracted from some json response of web service using default json decoder, json.load(….
I’ve got this error:
OverflowError: BSON can only handle up to 8-byte ints
Problem is caused by some values in python object which are decoded as long, and mongodb can’t handle those.
How can I solve this, any ideas here?
Custom decoder comes to mind, so when some big number is to be decoded to long > instead string to be used there.
Other solution would be: to get python object with some possible long fields in it and to convert all those to string.
I haven’t much experience with python and json. Any help would be appreciated
I’ve finally came to satisfying solution for problem:
so, key point here is:
parse_int=strwhich will decode every JSON int to string,so pymongo will swallow it with no problem.
Hope this helps someone.