Page Contents

Home > @loopback/repository > EntityCrudRepository > findById

EntityCrudRepository.findById() method

Find an entity by id, return a rejected promise if not found.

Signature:

findById(id: ID, filter?: Filter<T>, options?: Options): Promise<T & Relations>;

Parameters

Parameter Type Description
id ID Value for the entity id
filter Filter<T> Additional query options. E.g. filter.include configures which related models to fetch as part of the database query (or queries).
options Options Options for the operations

Returns:

Promise<T & Relations>

A promise of an entity found for the id