|
@@ -2,9 +2,9 @@ from pymongo import MongoClient
|
|
|
from src.domain.models import PalmOilBunch
|
|
from src.domain.models import PalmOilBunch
|
|
|
|
|
|
|
|
class MongoPalmOilRepository:
|
|
class MongoPalmOilRepository:
|
|
|
- def __init__(self, uri: str, db_name: str):
|
|
|
|
|
|
|
+ def __init__(self, uri: str, db_name: str, collection_name: str):
|
|
|
self.client = MongoClient(uri)
|
|
self.client = MongoClient(uri)
|
|
|
- self.collection = self.client[db_name]["ffb_records"]
|
|
|
|
|
|
|
+ self.collection = self.client[db_name][collection_name]
|
|
|
|
|
|
|
|
def save(self, bunch: PalmOilBunch):
|
|
def save(self, bunch: PalmOilBunch):
|
|
|
# Convert dataclass to dict for MongoDB
|
|
# Convert dataclass to dict for MongoDB
|