2019-09-13 21:12:58 +08:00
|
|
|
import json
|
2020-04-24 18:19:07 +08:00
|
|
|
|
2019-09-13 21:12:58 +08:00
|
|
|
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)
|