Spaces:
Running
Running
File size: 466 Bytes
884dad1 |
1 2 3 4 5 6 7 8 9 10 11 12 |
from pymongo.mongo_client import MongoClient
from pymongo.server_api import ServerApi
uri = "mongodb+srv://dacap3h:vMRoeFxX7Jjn2O5m@backup-data.m6pxu2j.mongodb.net/"
# Create a new client and connect to the server
client = MongoClient(uri, server_api=ServerApi('1'))
# Send a ping to confirm a successful connection
try:
client.admin.command('ping')
print("Pinged your deployment. You successfully connected to MongoDB!")
except Exception as e:
print(e)
|