---
lang: en
title: 'API docs: repository.modeldefinition'
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.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)

## ModelDefinition class

Definition for a model

<b>Signature:</b>

```typescript
export declare class ModelDefinition 
```

## Constructors

|  Constructor | Modifiers | Description |
|  --- | --- | --- |
|  [(constructor)(nameOrDef)](./repository.modeldefinition._constructor_.md) |  | Constructs a new instance of the <code>ModelDefinition</code> class |

## Properties

|  Property | Modifiers | Type | Description |
|  --- | --- | --- | --- |
|  [name](./repository.modeldefinition.name.md) |  | string |  |
|  [properties](./repository.modeldefinition.properties.md) |  | { \[name: string\]: [PropertyDefinition](./repository.propertydefinition.md)<!-- -->; } |  |
|  [relations](./repository.modeldefinition.relations.md) |  | [RelationDefinitionMap](./repository.relationdefinitionmap.md) |  |
|  [settings](./repository.modeldefinition.settings.md) |  | { \[name: string\]: any; } |  |

## Methods

|  Method | Modifiers | Description |
|  --- | --- | --- |
|  [addProperty(name, definitionOrType)](./repository.modeldefinition.addproperty.md) |  | Add a property |
|  [addRelation(definition)](./repository.modeldefinition.addrelation.md) |  | Define a new relation. |
|  [addSetting(name, value)](./repository.modeldefinition.addsetting.md) |  | Add a setting |
|  [idProperties()](./repository.modeldefinition.idproperties.md) |  | Get an array of names of ID properties, which are specified in the model settings or properties with <code>id</code> attribute. |


