mingo
    Preparing search index...
    • A utility function that manages memoization for window operators. It caches intermediate results for a given collection and field, and ensures proper cleanup after processing.

      Type Parameters

      • T = unknown

        The type of the cached value.

      • R = unknown

        The return type of the callback function.

      Parameters

      • collection: AnyObject[]

        The collection of documents being processed.

      • expr: Pick<WindowOperatorInput, "field" | "documentNumber">

        The window operator input containing metadata such as the field name and document number.

      • initialize: Callback<T>

        A callback function that computes and returns the cached value for the field.

      • fn: Callback<R, T>

        A callback function that processes the cached value and returns the result.

      Returns R

      The result of the fn callback function.

      Any errors thrown by the fn callback function.