Spaces:
Build error
Build error
Upload db.py
Browse files
db.py
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from pymongo import MongoClient
|
| 2 |
+
|
| 3 |
+
# MongoDB URI with actual credentials
|
| 4 |
+
CONNECTION_STRING = "mongodb+srv://transpolymer:transpolymer365@cluster0.2ojpls3.mongodb.net/?retryWrites=true&w=majority&appName=Cluster0"
|
| 5 |
+
|
| 6 |
+
# Function to get the database
|
| 7 |
+
def get_database():
|
| 8 |
+
client = MongoClient(CONNECTION_STRING)
|
| 9 |
+
return client["transpolymerDB"] # Your database name
|