---
lang: en
title: 'API docs: repository.hasonerepository.get'
keywords: LoopBack 4.0, LoopBack 4, Node.js, TypeScript, OpenAPI
sidebar: lb4_sidebar
editurl: https://github.com/loopbackio/loopback-next/tree/master/packages/repository
permalink: /doc/en/lb4/apidocs.repository.hasonerepository.get.html
---

<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@loopback/repository](./repository.md) &gt; [HasOneRepository](./repository.hasonerepository.md) &gt; [get](./repository.hasonerepository.get.md)

## HasOneRepository.get() method

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

<b>Signature:</b>

```typescript
get(filter?: Pick<Filter<Target>, Exclude<keyof Filter<Target>, 'where'>>, options?: Options & {
        polymorphicType?: string | string[];
    }): Promise<Target>;
```

## Parameters

|  Parameter | Type | Description |
|  --- | --- | --- |
|  filter | Pick&lt;[Filter](./filter.filter.md)<!-- -->&lt;Target&gt;, Exclude&lt;keyof [Filter](./filter.filter.md)<!-- -->&lt;Target&gt;, 'where'&gt;&gt; | <i>(Optional)</i> Query filter without a Where condition |
|  options | [Options](./repository.options.md) &amp; { polymorphicType?: string \| string\[\]; } | <i>(Optional)</i> Options for the operations options.polymorphicType - a string or a string array of polymorphic type names to specify which repositories should are expected to be searched It is highly recommended to contain this param especially for datasources using deplicated ids across tables |

<b>Returns:</b>

Promise&lt;Target&gt;

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


