logologo
Get Started
Guide
Development
Plugins
API
English
简体中文
Get Started
Guide
Development
Plugins
API
English
简体中文
logologo
API Overview

@nocobase/auth

AuthManager
Auth
BaseAuth

@nocobase/cli

NocoBase CLI
Global Environment Variables

@nocobase/client

Application
Plugin

@nocobase/database

Collection
Field

interfaces

BaseInterface
Filter Operators

RelationRepository

BelongsToManyRepository
belongs-to-repository
HasManyRepository
HasOneRepository
Repository

shared

create-options
destroy-options
find-one
find-options
transaction
update-options

@nocobase/flow-engine

DataSourceManager
FlowContext
FlowEngine
FlowModel
FlowResource

@nocobase/server

AppCommand
Application
AuditManager
Context
Migration
Plugin

@nocobase/sdk

Auth
Storage
Previous Pagebelongs-to-repository
Next PageHasOneRepository

#HasManyRepository

HasManyRepository is a Relation Repository used to handle HasMany relationships.

#Class Methods

#find()

Find associated objects

Signature

  • async find(options?: FindOptions): Promise<M[]>

Details

The query parameters are the same as Repository.find().

#findOne()

Find an associated object, returning only one record

Signature

  • async findOne(options?: FindOneOptions): Promise<M>

#count()

Returns the number of records that match the query conditions

Signature

  • async count(options?: CountOptions)

Type

interface CountOptions
  extends Omit<SequelizeCountOptions, 'distinct' | 'where' | 'include'>,
    Transactionable {
  filter?: Filter;
}

#findAndCount()

Queries the database for a dataset and the number of results that match specific conditions.

Signature

  • async findAndCount(options?: FindAndCountOptions): Promise<[any[], number]>

Type

type FindAndCountOptions = CommonFindOptions;

#create()

Create associated objects

Signature

  • async create(options?: CreateOptions): Promise<M>

#update()

Update associated objects that meet the conditions

Signature

  • async update(options?: UpdateOptions): Promise<M>

#destroy()

Delete associated objects that meet the conditions

Signature

  • async destroy(options?: TK | DestroyOptions): Promise<M>

#add()

Add object associations

Signature

  • async add(options: TargetKey | TargetKey[] | AssociatedOptions)

Type

interface AssociatedOptions extends Transactionable {
  tk?: TargetKey | TargetKey[];
}

Details

  • tk - The targetKey value of the associated object, which can be a single value or an array.

#remove()

Remove the association with the given objects

Signature

  • async remove(options: TargetKey | TargetKey[] | AssociatedOptions)

Details

Parameters are the same as the add() method.

#set()

Set the associated objects for the current relationship

Signature

  • async set(options: TargetKey | TargetKey[] | AssociatedOptions)

Details

Parameters are the same as the add() method.