def _aggregate(
        self,
        pipeline=None,
        media_type=None,
        attach_frames=False,
        detach_frames=False,
        frames_only=False,
        support=None,
        group_slice=None,
        group_slices=None,
        detach_groups=False,
        groups_only=False,
        manual_group_select=False,
        post_pipeline=None,
    ):
        """Runs the MongoDB aggregation pipeline on the collection and returns
        the result.

        Args:
            pipeline (None): a MongoDB aggregation pipeline (list of dicts) to
                append to the current pipeline
            media_type (None): the media type of the collection, if different
                than the source dataset's media type
            attach_frames (False): whether to attach the frame documents
                immediately prior to executing ``pipeline``. Only applicable to
                datasets that contain videos
            detach_frames (False): whether to detach the frame documents at the
                end of the pipeline. Only applicable to datasets that contain
                videos
            frames_only (False): whether to generate a pipeline that contains
                *only* the frames in the collection
            support (None): an optional ``[first, last]`` range of frames to
                attach. Only applicable when attaching frames
            group_slice (None): the current group slice of the collection, if
                different than the source dataset's group slice. Only
                applicable for grouped collections
            group_slices (None): an optional list of group slices to attach
                when ``groups_only`` is True
            detach_groups (False): whether to detach the group documents at the
                end of the pipeline. Only applicable to grouped collections
            groups_only (False): whether to generate a pipeline that contains
                *only* the flattened group documents for the collection
            manual_group_select (False): whether the pipeline has manually
                handled the initial group selection. Only applicable to grouped
                collections
            post_pipeline (None): a MongoDB aggregation pipeline (list of
                dicts) to append to the very end of the pipeline, after all
                other arguments are applied

        Returns:
            the aggregation result dict
        """
        raise NotImplementedError("Subclass must implement _aggregate()")
Runs the MongoDB aggregation pipeline on the collection and returns
        the result.

        Args:
            pipeline (None): a MongoDB aggregation pipeline (list of dicts) to
                append to the current pipeline
            media_type (None): the media type of the collection, if different
                than the source dataset's media type
            attach_frames (False): whether to attach the frame documents
                immediately prior to executing ``pipeline``. Only applicable to
                datasets that contain videos
            detach_frames (False): whether to detach the frame documents at the
                end of the pipeline. Only applicable to datasets that contain
                videos
            frames_only (False): whether to generate a pipeline that contains
                *only* the frames in the collection
            support (None): an optional ``[first, last]`` range of frames to
                attach. Only applicable when attaching frames
            group_slice (None): the current group slice of the collection, if
                different than the source dataset's group slice. Only
                applicable for grouped collections
            group_slices (None): an optional list of group slices to attach
                when ``groups_only`` is True
            detach_groups (False): whether to detach the group documents at the
                end of the pipeline. Only applicable to grouped collections
            groups_only (False): whether to generate a pipeline that contains
                *only* the flattened group documents for the collection
            manual_group_select (False): whether the pipeline has manually
                handled the initial group selection. Only applicable to grouped
                collections
            post_pipeline (None): a MongoDB aggregation pipeline (list of
                dicts) to append to the very end of the pipeline, after all
                other arguments are applied

        Returns:
            the aggregation result dict
        
fiftyone/core/collections.py