Implement the fundamental Create, Read, Update, and Delete (CRUD) operations within the VellumRepository class, linking VellumBaseModel instances to MongoDB. Tasks:
Implement init(self, model: Type[VellumBaseModel], client: AsyncIOMotorClient, db_name: str).
create(doc: VellumBaseModel) -> VellumBaseModel: Handles _id and timestamps.
get(doc_id: UUID) -> Optional[VellumBaseModel]: Fetches by _id, validates with Pydantic.
find(filter: Dict, skip: int=0, limit: int=0, sort: Optional[List[Tuple[str, int]]]=None) -> List[VellumBaseModel]: Basic querying, Pydantic validation on results.
update(doc_id: UUID, update_data: Union[BaseModel, Dict]) -> Optional[VellumBaseModel]: Handles $set operator, updates updated_at.
delete(doc_id: UUID) -> bool.
count(filter: Dict = {}) -> int.
Implement the fundamental Create, Read, Update, and Delete (CRUD) operations within the VellumRepository class, linking VellumBaseModel instances to MongoDB. Tasks:
Implement init(self, model: Type[VellumBaseModel], client: AsyncIOMotorClient, db_name: str).
create(doc: VellumBaseModel) -> VellumBaseModel: Handles _id and timestamps.
get(doc_id: UUID) -> Optional[VellumBaseModel]: Fetches by _id, validates with Pydantic.
find(filter: Dict, skip: int=0, limit: int=0, sort: Optional[List[Tuple[str, int]]]=None) -> List[VellumBaseModel]: Basic querying, Pydantic validation on results.
update(doc_id: UUID, update_data: Union[BaseModel, Dict]) -> Optional[VellumBaseModel]: Handles $set operator, updates updated_at.
delete(doc_id: UUID) -> bool.
count(filter: Dict = {}) -> int.