def METHOD_NAME(downstream_domain, use_upstream_app_id=True):
    """
    :param downstream_domain: domain name
    :param use_upstream_app_id: whether to search for downstream app based on upstream_app_id or family_id
    DEPRECATED: family_id is deprecated and will be removed. If calling this method, try to use upstream_app_id
    """
    attr_to_search_on = "upstream_app_id" if use_upstream_app_id else "family_id"
    downstream_app_ids = defaultdict(list)
    for doc in get_brief_app_docs_in_domain(downstream_domain):
        if doc.get(attr_to_search_on):
            downstream_app_ids[doc[attr_to_search_on]].append(doc["_id"])
    return downstream_app_ids