def find_posts(uri: str, db_name: str, collection_name: str, query: Dict) -> List['BlogPost']: db = Database(uri=uri, db_name=db_name) results = db.find(collection_name=collection_name, query=query) results = [BlogPost.wrap_result(result) for result in results] if results else results return results
def find_blogs(blog_config: BlogConfig, query: dict) -> List['Blog']: db = Database(uri=blog_config.uri, db_name=blog_config.db_name) results = db.find(collection_name=blog_config.collection_name_blogs, query=query) results = [Blog.wrap_result(result) for result in results] if results else results return results