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:
parent
230a792d5c
commit
3668862faa
1 changed files with 2 additions and 1 deletions
|
@ -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 = {
|
||||||
|
|
Loading…
Reference in a new issue