from typing import Optional


def _transform_op(op: Optional[str]) -> str:
    """Transforms an operator for MongoDB compatibility.

    This method takes an operator (as specified in a keyword argument) and transforms it
    to a ``$`` prefixed camel case operator for MongoDB.
    """
    if op is None:
        return "$eq"

    camel = op[0].lower() + op.title()[1:].replace("_", "")
    return f"${camel}"