---
lang: en
title: 'API docs: repository.modeldefinition.addrelation'
keywords: LoopBack 4.0, LoopBack 4
sidebar: lb4_sidebar
permalink: /doc/en/lb4/apidocs.repository.modeldefinition.addrelation.html
---

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

[Home](./index.md) &gt; [@loopback/repository](./repository.md) &gt; [ModelDefinition](./repository.modeldefinition.md) &gt; [addRelation](./repository.modeldefinition.addrelation.md)

## ModelDefinition.addRelation() method

Define a new relation.

<b>Signature:</b>

```typescript
addRelation(definition: RelationMetadata): this;
```

## Parameters

|  Parameter | Type | Description |
|  --- | --- | --- |
|  definition | <code>RelationMetadata</code> | The definition of the new relation. |

<b>Returns:</b>

`this`


