from pymongo import MongoClient
from dotenv import load_dotenv
import os
load_dotenv()
MONGO_URI=os.getenv("MONGO_URI")
MONGO_DB=os.getenv("MONGO_DB")

def find_all(collectionName: str):
    client = MongoClient(MONGO_URI)
    db = client[MONGO_DB]
    collection = db[collectionName]
    data = collection.find()
    return list(data)


def find_status_server_product(collectionName: str):
    client = MongoClient(MONGO_URI)
    db = client[MONGO_DB]
    collection = db[collectionName]
    data = collection.find_one({"_id": "statusserver"}) 
    return data
