-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c9d430b
commit b6bd0cc
Showing
2 changed files
with
8 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,11 @@ | ||
from loguru import logger | ||
from zenml.steps import step | ||
|
||
from second_brain.infrastructure.mongo import MongoDBService | ||
|
||
|
||
@step | ||
def fetch_from_mongodb(limit: int, collection_name: str) -> list[dict]: | ||
try: | ||
service = MongoDBService(collection_name=collection_name) | ||
with MongoDBService(collection_name=collection_name) as service: | ||
documents = service.fetch_documents(limit, query={}) | ||
|
||
# Fetch documents | ||
query = {} | ||
documents = service.fetch_documents(limit, query) | ||
|
||
# Log genre-specific counts | ||
# service.verify_genre(genre) | ||
|
||
return documents | ||
except Exception as e: | ||
logger.error(f"Failed to fetch documents: {e}") | ||
raise | ||
return documents |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters