@loopback/docs
Version:
Documentation for LoopBack 4
37 lines (23 loc) • 1.11 kB
Markdown
---
lang: en
title: 'API docs: repository.hasonerepository.get'
keywords: LoopBack 4.0, LoopBack 4
sidebar: lb4_sidebar
permalink: /doc/en/lb4/apidocs.repository.hasonerepository.get.html
---
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) > [@loopback/repository](./repository.md) > [HasOneRepository](./repository.hasonerepository.md) > [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): Promise<Target>;
```
## Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| filter | <code>Pick<Filter<Target>, Exclude<keyof Filter<Target>, 'where'>></code> | Query filter without a Where condition |
| options | <code>Options</code> | Options for the operations |
<b>Returns:</b>
`Promise<Target>`
A promise of the target object or null if not found.