Page Contents

Home > @loopback/repository > CrudConnector > exists

CrudConnector.exists() method

Check if an entity exists for the id

Signature:

exists?<IdType>(modelClass: Class<Entity>, id: IdType, options?: Options): Promise<boolean>;

Parameters

Parameter Type Description
modelClass Class<Entity> The model class
id IdType The entity id value
options Options (Optional) Options for the operation

Returns:

Promise<boolean>

Promise if an entity exists for the id, otherwise Promise