def FILTER(_input, _as, cond):
    """
    Selects a subset of an array to return based on the specified condition. \
    Returns an array with only those elements that match the condition.
    The returned elements are in the original order.
    See https://docs.mongodb.com/manual/reference/operator/aggregation/filter/
    for more details
    :param _input: An expression that resolves to an array.
    :param _as: A name for the variable that represents each individual element of the input array.
    :param cond: An expression that resolves to a boolean value used to determine if an element should be included in the output array.
    :return: Aggregation operator
    """
    return {'$filter': {'input': _input, 'as': _as, 'cond': cond}}