Utility models and protocols
ClientProvider
DatabaseProvider
DeleteResultModel
DocumentModel
Bases: BaseModel
Pydantic base model for MongoDB documents.
It exposes the _id attribute as id.
Source code in fastapi_motor_oil/model.py
StrObjectId
Bases: ObjectId
Custom BSON ObjectId for use with Pydantic.
Source code in fastapi_motor_oil/model.py
validate(value)
classmethod
Checks whether the given value is a valid ObjectId
UTCDatetime
Bases: datetime
Pydantic datetime field that enforces UTC timezone.
Source code in fastapi_motor_oil/model.py
ensure_utc(value)
classmethod
Makes sure the given datetime is in UTC.
If value has no timezone info, the method sets UTC.
Raises:
| Type | Description |
|---|---|
ValueError
|
If |