API 参考
    正在准备搜索索引...

    接口 FindManyOptions<Entity>

    Defines a special criteria to find specific entities.

    interface FindManyOptions<Entity = any> {
        cache?: number | boolean | { id: any; milliseconds: number };
        comment?: string;
        join?: JoinOptions;
        loadEagerRelations?: boolean;
        loadRelationIds?:
            | boolean
            | { disableMixedMap?: boolean; relations?: string[] };
        lock?:
            | { mode: "optimistic"; version: number
            | Date }
            | {
                mode:
                    | "pessimistic_read"
                    | "pessimistic_write"
                    | "dirty_read"
                    | "pessimistic_partial_write"
                    | "pessimistic_write_or_fail"
                    | "for_no_key_update"
                    | "for_key_share";
                onLocked?: "nowait"
                | "skip_locked";
                tables?: string[];
            };
        order?: FindOptionsOrder<Entity>;
        relationLoadStrategy?: "join" | "query";
        relations?: FindOptionsRelationByString | FindOptionsRelations<Entity>;
        select?: FindOptionsSelect<Entity> | FindOptionsSelectByString<Entity>;
        skip?: number;
        take?: number;
        transaction?: boolean;
        where?: FindOptionsWhere<Entity> | FindOptionsWhere<Entity>[];
        withDeleted?: boolean;
    }

    类型参数

    • Entity = any

    层级 (查看层级一览)

    索引

    属性

    cache?: number | boolean | { id: any; milliseconds: number }

    Enables or disables query result caching.

    comment?: string

    Adds a comment with the supplied string in the generated query. This is helpful for debugging purposes, such as finding a specific query in the database server's logs, or for categorization using an APM product.

    Specifies what relations should be loaded.

    loadEagerRelations?: boolean

    Indicates if eager relations should be loaded or not. By default, they are loaded when find methods are used.

    loadRelationIds?: boolean | { disableMixedMap?: boolean; relations?: string[] }

    If sets to true then loads all relation ids of the entity and maps them into relation values (not relation objects). If array of strings is given then loads only relation ids of the given properties.

    lock?:
        | { mode: "optimistic"; version: number
        | Date }
        | {
            mode:
                | "pessimistic_read"
                | "pessimistic_write"
                | "dirty_read"
                | "pessimistic_partial_write"
                | "pessimistic_write_or_fail"
                | "for_no_key_update"
                | "for_key_share";
            onLocked?: "nowait"
            | "skip_locked";
            tables?: string[];
        }

    Indicates what locking mode should be used.

    Note: For lock tables, you must specify the table names and not the relation names

    Order, in which entities should be ordered.

    relationLoadStrategy?: "join" | "query"

    Specifies how relations must be loaded - using "joins" or separate queries. If you are loading too much data with nested joins it's better to load relations using separate queries.

    Default strategy is "join", but default can be customized in connection options.

    Indicates what relations of entity should be loaded (simplified left join form).

    Specifies what columns should be retrieved.

    skip?: number

    Offset (paginated) where from entities should be taken.

    take?: number

    Limit (paginated) - max number of entities should be taken.

    transaction?: boolean

    If this is set to true, SELECT query in a find method will be executed in a transaction.

    Simple condition that should be applied to match entities.

    withDeleted?: boolean

    Indicates if soft-deleted rows should be included in entity result.