def get_mongo_key(f, *args, **kwargs):
    """
    Returns a mongo object key for the function.

    Args:
        f: the function
        args: positional arguments
        kwargs: keyword arguments
    Returns:
        The key.
    """

    min_kwargs = list(filter(lambda pair: pair[1] is not None, kwargs.items()))

    return {
        "function": "{}.{}".format(f.__module__, f.__name__),
        "args": args,
        "ordered_kwargs": sorted(min_kwargs),
        "kwargs": dict(min_kwargs)
    }