update mongo client to use global mongo vars

This commit is contained in:
Brandon Egger 2023-03-19 22:37:52 -05:00
parent edc979debb
commit 3e67399d1a

View File

@ -4,6 +4,7 @@ import pandas as pd
import numpy as np
MONGO_URL = "mongodb://localhost:27017/atr_db?replicaSet=test"
MONGO_DB = "dev"
def upload_to_mongo(resources, ar_col):
ar_col.insert_many(resources)
@ -35,8 +36,8 @@ def get_platform_links(row):
def main(path: str):
df = pd.read_excel(path, header=[0,1])
mongo_client = pymongo.MongoClient("mongodb://localhost:27017/atr_db?replicaSet=test")
mongo_db = mongo_client["atr_db"]
mongo_client = pymongo.MongoClient(MONGO_URL)
mongo_db = mongo_client[MONGO_DB]
ar_col = mongo_db["AuditoryResource"]
resources = []