I’m looking for help for the following problem:
I develop a blockchain web application in Python 3.7, using MongoDB as a backend, so obviously I use the pymongo driver and Flask as well.
If I collect the data as elements of a response of a web request and write it to the DB (but not reading from it), the ObjectID becomes the part of the response (in-memory) and get an error 500 as the ObjectID - of course - is not a JSON serializable. I already tried to define a json decoder but it didn’t have any affect. I also tried to use a different variable and call the DB write operation from a completely separated module but the ObjectID still becomes the part of the in-memory response. So all in all, I’m suspecting that pymongo tricks me.
Do you have any recommendation, where to go from now? I really appreciate any recommendation!
ps: I do apologize if my english is poor, I’m not a native speaker.