---
lang: en
title: 'API docs: repository.modeldefinition.addrelation'
keywords: LoopBack 4.0, LoopBack 4, Node.js, TypeScript, OpenAPI
sidebar: lb4_sidebar
editurl: https://github.com/strongloop/loopback-next/tree/master/packages/repository
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 | [RelationMetadata](./repository.relationmetadata.md) | The definition of the new relation. |

<b>Returns:</b>

this


