File size: 551 Bytes
7b5e0ec
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import os
import pymongo

user_name = os.getenv("MONGO_DB_USERNAME")
password = os.getenv("MONGO_DB_PASSWORD")

# Replace these with your MongoDB cluster connection details
mongo_uri = uri = f"mongodb+srv://{user_name}:{password}@cluster0.mrrq3sf.mongodb.net/?retryWrites=true&w=majority"
database_name = "ophthal-llm"
collection_name = "drvai-deployment"


def insert_one(document):
    client = pymongo.MongoClient(mongo_uri)
    db = client[database_name]
    collection = db[collection_name]
    collection.insert_one(document)
    client.close()