Page Contents

Home > @loopback/repository > HasOneRepository > get

HasOneRepository.get() method

Find the only target model instance that belongs to the declaring model.

Signature:

get(filter?: Pick<Filter<Target>, Exclude<keyof Filter<Target>, 'where'>>, options?: Options): Promise<Target>;

Parameters

Parameter Type Description
filter Pick<Filter<Target>, Exclude<keyof Filter<Target>, ‘where’>> Query filter without a Where condition
options Options Options for the operations

Returns:

Promise<Target>

A promise resolved with the target object or rejected with an EntityNotFoundError when target model instance was not found.