diff --git a/PyScripts/MongoDB.py b/PyScripts/MongoDB.py new file mode 100644 index 0000000..0be2352 --- /dev/null +++ b/PyScripts/MongoDB.py @@ -0,0 +1,11 @@ +from pymongo.mongo_client import MongoClient +from pymongo.server_api import ServerApi +uri = "mongodb+srv://ruwindhu123:hM3PL1jFnuV7ZBl3@nba2023.hxrsjnm.mongodb.net/?retryWrites=true&w=majority" +# 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)