1
0
Fork 0
mirror of https://github.com/ThomasGsp/HyperProxmox.git synced 2025-02-13 03:32:16 +00:00

Fix MongoDB - find by ID

This commit is contained in:
Tlams 2018-02-18 17:52:09 +00:00
parent 230a792d5c
commit 3668862faa

View file

@ -1,4 +1,5 @@
from pymongo import MongoClient from pymongo import MongoClient
from bson.objectid import ObjectId
from bson.json_util import dumps from bson.json_util import dumps
import json import json
import redis import redis
@ -86,7 +87,7 @@ class MongoDB:
try: try:
result = { result = {
"result": "OK", "result": "OK",
"value": json.loads(dumps(self.db[collection].find({"_id": id}))) "value": json.loads(dumps(self.db[collection].find_one({"_id": ObjectId(id)})))
} }
except BaseException as e: except BaseException as e:
result = { result = {