velocity_agent_layer / components /mongodbconnection.py
Junaidb's picture
Create mongodbconnection.py
9491b2c verified
raw
history blame contribute delete
408 Bytes
from pymongo.mongo_client import MongoClient
from pymongo.server_api import ServerApi
uri = "mongodb+srv://junaid:junaid@cluster0.0ec6y.mongodb.net/?appName=Cluster0"
client = MongoClient(uri, server_api=ServerApi('1'))
try:
client.admin.command('ping')
print("Pinged your deployment. You successfully connected to MongoDB!")
except Exception as e:
print(e)
def provideClient():
return client