/* * MIT License * * Copyright (c) 2018-2020 Ardalan Amini * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ import { JoinQuery, Order } from "."; import Filter from "./Filter"; declare class Join = any> extends Filter { protected _ancestor: string; protected _collection: string; protected _as: string; protected _pipeline: Record[]; protected _let: { [key: string]: any; }; get pipeline(): { $lookup: { let: { [key: string]: any; }; from: string; pipeline: Record[]; as: string; }; }; constructor(_ancestor: string, _collection: string, _as?: string); /********************************** Helpers *********************************/ protected _resetFilters(): this; protected _shouldPushExpr(value: any): boolean; protected _where(field: string, operator: string, value: any): this; protected _or_where(field: string, operator: string, value: any): this; /********************************** Extra **********************************/ aggregate(...objects: Record[] | Record[][]): this; /*********************************** Joins **********************************/ join(collection: string, query?: JoinQuery, as?: string): this; /********* Mapping, Ordering, Grouping, Limit, Offset & Pagination *********/ orderBy(field: K, order?: Order): this; orderBy(field: string, order?: Order): this; orderBy(fields: { [field: string]: "asc" | "desc"; }): this; skip(offset: number): this; offset(offset: number): this; limit(limit: number): this; take(limit: number): this; paginate(page?: number, limit?: number): this; /******************************* Where Clauses ******************************/ whereIn(field: string, embeddedField: string): this; whereIn(field: K, embeddedField: string): this; whereIn(field: string, values: any[]): this; whereIn(field: K, values: Array): this; whereNotIn(field: string, embeddedField: string): this; whereNotIn(field: K, embeddedField: string): this; whereNotIn(field: string, values: any[]): this; whereNotIn(field: K, values: Array): this; } export default Join;