Function filterDocuments

  • Filters the documents from an async generator and yield them by the condition

    Type Parameters

    • T extends unknown

    Parameters

    • iterator: AsyncGenerator<T | T[], void, unknown>

      The async generator to resolve documents from.

    • predicate: ((value: T) => boolean | Promise<boolean>)
        • (value): boolean | Promise<boolean>
        • Parameters

          • value: T

          Returns boolean | Promise<boolean>

    Returns AsyncGenerator<Awaited<T>, void, unknown>

    • A promise that resolves to the flattened array of documents.