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 of the target object or null if not found.