Spaces:
Sleeping
Sleeping
Delete utils/mongoDB.py
Browse files- utils/mongoDB.py +0 -22
utils/mongoDB.py
DELETED
|
@@ -1,22 +0,0 @@
|
|
| 1 |
-
#!/usr/bin/env python3
|
| 2 |
-
# -*- coding: utf-8 -*-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
import pymongo
|
| 6 |
-
import json
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
class MongoDBConnector():
|
| 10 |
-
def __init__(self, str_conn):
|
| 11 |
-
self.str_connnection = json.loads(str_conn)['conn_string']
|
| 12 |
-
self.db_name = json.loads(str_conn)['db_name']
|
| 13 |
-
|
| 14 |
-
def get_mongo_connection_string(self):
|
| 15 |
-
if not self.str_connnection.startswith("mongodb://"):
|
| 16 |
-
self.str_connnection = "mongodb://" + self.str_connnection
|
| 17 |
-
return self.str_connnection
|
| 18 |
-
|
| 19 |
-
def get_mongo_client(self):
|
| 20 |
-
conn_string = self.get_mongo_connection_string()
|
| 21 |
-
return pymongo.MongoClient(host=conn_string)
|
| 22 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|