from typing import Union
from typing import Dict
from typing import Any


async def get_one_field(collection, field: str, query: Union[str, Dict]) -> Any:
    """
    Get the value for a single `field` from a single document matching the `query`.

    :param collection: the database collection to search
    :param field: the field to return
    :param query: the document matching query
    :return: the field

    """
    projected = await collection.find_one(query, [field])

    if projected is None:
        return None

    return projected.get(field)