10 lines
224 B
Python
10 lines
224 B
Python
|
import json
|
||
|
from bson import ObjectId
|
||
|
|
||
|
|
||
|
class MongoQueryJSONEncoder(json.JSONEncoder):
|
||
|
def default(self, o):
|
||
|
if isinstance(o, ObjectId):
|
||
|
return str(o)
|
||
|
return json.JSONEncoder.default(self, o)
|