/** * SQL Mode 2 — JOIN Translator * * INNER JOIN → $lookup + $unwind * LEFT JOIN → $lookup + $unwind (preserveNullAndEmptyArrays: true) * RIGHT JOIN → swap collections, LEFT JOIN * FULL OUTER JOIN → two pipelines merged * CROSS JOIN → $lookup with empty pipeline (cartesian product) */ import type { JoinInfo, PipelineDef } from '../types.js'; export interface JoinResult { stages: Record[]; /** For FULL OUTER JOINs, the second pipelines (one per FULL OUTER JOIN) */ secondPipelines?: PipelineDef[]; /** The main collection (may be swapped for RIGHT JOIN) */ mainCollection?: string; } /** * Extract JOIN info from AST FROM clause. */ export declare function extractJoins(from: unknown): JoinInfo[]; /** * Translate JOINs into pipeline stages. * @param pushdownFilters — optional map of join alias/table → MongoDB filter to push into $lookup pipeline */ export declare function translateJoins(from: unknown, mainCollection: string, pushdownFilters?: Map>): JoinResult; /** * Split a WHERE AST into conditions for the main table vs joined tables. * Returns main-table conditions and a map of joinAlias → conditions for pushdown. */ export declare function splitWhereByTable(where: unknown, mainAliases: Set, joinAliases: Set): { mainWhere: unknown; pushdownMap: Map>; }; //# sourceMappingURL=joins.d.ts.map