File size: 389 Bytes
7bb1ee2
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
from pymongo import MongoClient

uri = "mongodb+srv://soham:Soham2001@potholedetection.gt3rb.mongodb.net/?retryWrites=true&w=majority&appName=potholeDetection"

try:
    client = MongoClient(uri)
    db = client.admin  # Use the "admin" database for the ping command
    result = db.command("ping")
    print("Ping successful:", result)
except Exception as e:
    print("Ping failed:", e)