---
lang: en
title: 'API docs: repository.hasonerepository.patch'
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.patch.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; [patch](./repository.hasonerepository.patch.md)

## HasOneRepository.patch() method

Patch the related target model instance

<b>Signature:</b>

```typescript
patch(dataObject: DataObject<Target> | {
        [polymorphicType: string]: DataObject<Target>;
    }, options?: Options & {
        isPolymorphic?: boolean;
    }): Promise<Count>;
```

## Parameters

|  Parameter | Type | Description |
|  --- | --- | --- |
|  dataObject | [DataObject](./repository.dataobject.md)<!-- -->&lt;Target&gt; \| { \[polymorphicType: string\]: [DataObject](./repository.dataobject.md)<!-- -->&lt;Target&gt;; } | The target model fields and their new values to patch If the target models are of different types, this should be a dictionary |
|  options | [Options](./repository.options.md) &amp; { isPolymorphic?: boolean; } | <i>(Optional)</i> options.isPolymorphic - whether dataObject is a dictionary |

<b>Returns:</b>

Promise&lt;[Count](./repository.count.md)<!-- -->&gt;

A promise which resolves the patched target model instances


