@loopback/docs
Version:
Documentation for LoopBack 4
38 lines (24 loc) • 1.12 kB
Markdown
---
lang: en
title: 'API docs: repository.entitycrudrepository.replacebyid'
keywords: LoopBack 4.0, LoopBack 4
sidebar: lb4_sidebar
permalink: /doc/en/lb4/apidocs.repository.entitycrudrepository.replacebyid.html
---
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) > [@loopback/repository](./repository.md) > [EntityCrudRepository](./repository.entitycrudrepository.md) > [replaceById](./repository.entitycrudrepository.replacebyid.md)
## EntityCrudRepository.replaceById() method
Replace an entity by id
<b>Signature:</b>
```typescript
replaceById(id: ID, data: DataObject<T>, options?: Options): Promise<void>;
```
## Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| id | <code>ID</code> | Value for the entity id |
| data | <code>DataObject<T></code> | Data attributes to be replaced |
| options | <code>Options</code> | Options for the operations |
<b>Returns:</b>
`Promise<void>`
A promise that will be resolve if the operation succeeded or will be rejected if the entity was not found.