diff options
| -rw-r--r-- | opendc/util/database.py | 4 | ||||
| -rw-r--r-- | setup.py | 3 |
2 files changed, 4 insertions, 3 deletions
diff --git a/opendc/util/database.py b/opendc/util/database.py index 9b570d0d..20006ff2 100644 --- a/opendc/util/database.py +++ b/opendc/util/database.py @@ -4,7 +4,7 @@ import sys from datetime import datetime from pymongo import MongoClient from bson.json_util import loads, dumps, RELAXED_JSON_OPTIONS, CANONICAL_JSON_OPTIONS - +import urllib.parse #from mysql.connector.pooling import MySQLConnectionPool @@ -122,7 +122,7 @@ def fetchall(query, collection): results = [] cursor = prefabs_collection.find(query) for doc in cursor: - json_string = dumps(bson) #convert BSON representation to JSON + json_string = dumps(doc) #convert BSON representation to JSON json_obj = json.loads(json_string) #load as a JSON object #leave the id field in for now, we can use it later #json_obj.pop("_id") @@ -42,6 +42,7 @@ setup( 'flask-cors==3.0.8', 'pyasn1-modules==0.2.2', 'six==1.11.0', - 'pymongo==3.10.1' + 'pymongo==3.10.1', + 'bson==0.5.10' ], ) |
