Page Contents

Home > @loopback/repository > CrudConnector > replaceById

CrudConnector.replaceById() method

Replace an entity by id

Signature:

replaceById?<IdType>(modelClass: Class<Entity>, id: IdType, data: EntityData, options?: Options): Promise<boolean>;

Parameters

Parameter Type Description
modelClass Class<Entity> The model class
id IdType The entity id value
data EntityData The data attributes to be updated
options Options Options for the operation

Returns:

Promise<boolean>

Promise if an entity is replaced for the id, otherwise Promise