interface ListUsersRepository {
    modelName: string;
    countDocuments(query?: FilterQuery<BaseListUser>): Promise<number>;
    create(entity: BaseListUser): Promise<Saved<BaseListUser>>;
    createMany(
        entity: BaseListUser[],
        options?: CreateManyOptions,
    ): Promise<string[]>;
    deleteById(id: string): Promise<null | Saved<BaseListUser>>;
    destroyById(id: string): Promise<null | Saved<BaseListUser>>;
    findById(
        id: string,
        fields?: SelectQuery<BaseListUser>[],
        ListQueryOptions?: ListQueryOptions<BaseListUser>,
    ): Promise<null | Saved<BaseListUser>>;
    findOne(
        query?: FilterQuery<BaseListUser>,
        fields?: SelectQuery<BaseListUser>[],
        ListQueryOptions?: ListQueryOptions<BaseListUser>,
    ): Promise<null | Saved<BaseListUser>>;
    getAudienceFromHostMarketingList(
        listId: string,
        extendedData?: boolean,
    ): Promise<Readable>;
    getListLength(listId: string): Promise<undefined | number>;
    list(
        query?: FilterQuery<BaseListUser>,
        fields?: SelectQuery<BaseListUser>[],
        ListQueryOptions?: ListQueryOptions<BaseListUser>,
    ): Promise<Saved<BaseListUser>[]>;
    paginate(
        options?: PaginateQueryOptions<BaseListUser>,
    ): Promise<PaginationResponse<Saved<BaseListUser>>>;
    updateById(
        id: string,
        entity: PartialQuery<BaseListUser>,
        options?: UpdateOptions,
    ): Promise<null | Saved<BaseListUser>>;
    updateMany(
        filter: FilterQuery<BaseListUser>,
        update: PartialQuery<BaseListUser>,
    ): Promise<number>;
    updateOne(
        filter: FilterQuery<BaseListUser>,
        update: PartialQuery<BaseListUser>,
        options?: UpdateOneOptions,
    ): Promise<null | Saved<BaseListUser>>;
    upsertOne(
        filter: FilterQuery<BaseListUser>,
        entity: PartialQuery<BaseListUser>,
    ): Promise<null | string>;
}

Hierarchy (View Summary)

Properties

modelName: string

The name of the model.

Methods

  • Upsert a single record based on certain criteria.

    Parameters

    • filter: FilterQuery<BaseListUser>

      The filter to find the record to update or insert.

    • entity: PartialQuery<BaseListUser>

      The entity to upsert.

    Returns Promise<null | string>

    The return types of this method align with the MongoDB UpdateResult interface

    • Returns models.baseModel.Saved<T>['_id'] if the document did not exist (an upsert took place).
    • Returns null if the document did exist before the upsert operation.