You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
15 lines
507 B
15 lines
507 B
from pymongo.mongo_client import MongoClient
|
|
from pymongo.server_api import ServerApi
|
|
|
|
uri = "mongodb+srv://kye:Kgx7d2FeLN7AyGNh@cluster0.ndu3b6d.mongodb.net/?retryWrites=true&w=majority&appName=Cluster0"
|
|
|
|
# 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)
|