from pydantic import BaseSettings, BaseModel from typing import Any, List, Optional class Database: def __init__(self, model): self.model = model
The model passed during initialization is either the
User document model class.
async def save(self, document) -> None: await document.create() return
In this code block, we have defined the
save method to take the document, which will be an instance of the document passed to the
Database instance at the point of instantiation.