Skip to content

Helper types

MongoProjection = dict[str, Any] module-attribute

MongoDB projection object.

MongoQuery = dict[str, Any] module-attribute

MongoDB query object.

UpdateObject = dict[str, Any] | Sequence[dict[str, Any]] module-attribute

MongoDB update object.

CollationDict

Bases: TypedDict

Collation definition as a dict.

Source code in fastapi_motor_oil/typing.py
class CollationDict(TypedDict, total=False):
    """
    Collation definition as a dict.
    """

    locale: str
    caseLevel: bool | None
    caseFirst: str | None
    strength: int | None
    numericOrdering: bool | None
    alternate: str | None
    maxVariable: str | None
    normalization: bool | None
    backwards: bool | None

CollectionOptions

Bases: TypedDict

Collection options.

Source code in fastapi_motor_oil/typing.py
class CollectionOptions(TypedDict, total=False):
    """
    Collection options.
    """

    codec_options: "CodecOptions[Any]" | None  # Default is None
    read_preference: Primary | PrimaryPreferred | Secondary | SecondaryPreferred | Nearest | None  # Default  None
    write_concern: WriteConcern | None  # Default is None
    read_concern: ReadConcern | None  # Default is None

DeleteOptions

Bases: TypedDict

Delete options.

Source code in fastapi_motor_oil/typing.py
class DeleteOptions(TypedDict, total=False):
    """
    Delete options.
    """

    collation: Mapping[str, Any] | Collation | None  # Default is None
    hint: str | Sequence[tuple[str, int | str | Mapping[str, Any]]] | None  # Default is None
    session: AgnosticCollection | None  # Default is None
    let: Mapping[str, Any] | None  # Default is None
    comment: Any | None  # Default is None

FindOptions

Bases: TypedDict

Find options.

Source code in fastapi_motor_oil/typing.py
class FindOptions(TypedDict, total=False):
    """
    Find options.
    """

    skip: int  # Default is 0
    limit: int  # Default is 0
    no_cursor_timeout: bool  # Default is False
    cursor_type: int  # Default is pymongo.cursor.CursorType.NON_TAILABLE
    sort: Sequence[tuple[str, int | str | Mapping[str, Any]]] | None  # Default is None
    allow_partial_results: bool  # Default is False
    oplog_replay: bool  # Default is False
    batch_size: int  # Default is 0
    collation: Mapping[str, Any] | Collation | None  # Default is None
    hint: str | Sequence[tuple[str, int | str | Mapping[str, Any]]] | None  # Default is None
    max_scan: int | None  # Default is None
    max_time_ms: int | None  # Default is None
    max: Sequence[tuple[str, int | str | Mapping[str, Any]]] | None  # Default is None
    min: Sequence[tuple[str, int | str | Mapping[str, Any]]] | None  # Default is None
    return_key: bool | None  # Default is None
    show_record_id: bool | None  # Default is None
    snapshot: bool | None  # Default is None
    comment: Any | None  # Default is None
    session: AgnosticCollection | None  # Default is None
    allow_disk_use: bool | None  # Default is None
    let: bool | None  # Default is None

IndexData dataclass

Index data description.

Source code in fastapi_motor_oil/typing.py
@dataclass(frozen=True, kw_only=True, slots=True)
class IndexData:
    """
    Index data description.
    """

    keys: str | Sequence[tuple[str, int | str | Mapping[str, Any]]]
    unique: bool = False
    background: bool = False
    collation: Collation | None = None
    sparse: bool = False
    extra: dict[str, Any] = field(default_factory=dict)

InsertOneOptions

Bases: TypedDict

Insert options.

Source code in fastapi_motor_oil/typing.py
class InsertOneOptions(TypedDict, total=False):
    """
    Insert options.
    """

    bypass_document_validation: bool  # Default is False
    session: AgnosticCollection | None  # Default is None
    comment: Any | None  # Default is None

UpdateManyOptions

Bases: TypedDict

Update-many options.

Source code in fastapi_motor_oil/typing.py
class UpdateManyOptions(TypedDict, total=False):
    """
    Update-many options.
    """

    upsert: bool  # Default is False
    array_filters: Sequence[Mapping[str, Any]] | None  # Default is None
    bypass_document_validation: bool  # Default is None
    collation: Mapping[str, Any] | Collation | None  # Default is None
    hint: str | Sequence[tuple[str, int | str | Mapping[str, Any]]] | None  # Default is None
    session: AgnosticCollection | None  # Default is None
    let: Mapping[str, Any] | None  # Default is None
    comment: Any | None  # Default is None

UpdateOneOptions

Bases: TypedDict

Update-one options.

Source code in fastapi_motor_oil/typing.py
class UpdateOneOptions(TypedDict, total=False):
    """
    Update-one options.
    """

    upsert: bool  # Default is False
    bypass_document_validation: bool  # Default is False
    collation: Mapping[str, Any] | Collation | None  # Default is None
    array_filters: Sequence[Mapping[str, Any]]  # Default is None
    hint: str | Sequence[tuple[str, int | str | Mapping[str, Any]]] | None  # Default is None
    session: AgnosticCollection | None  # Default is None
    let: Mapping[str, Any] | None  # Default is None
    comment: Any | None  # Default is None