# Mapping relational field thegraph

**URL:** <https://forum.thegraph.com/t/mapping-relational-field-thegraph/3112>\
**Category:** Questions\
**Tags:** subgraph-devs\
**Created:** [February 19, 2022, 8:27am UTC](https://forum.thegraph.com/t/mapping-relational-field-thegraph/3112 "2022-02-19T08:27:07Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![nami-suki](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.thegraph.com/nami-suki/32/1233_2.png) [@nami-suki](https://forum.thegraph.com/u/nami-suki)\
**Post date:** [February 19, 2022, 8:27am UTC](https://forum.thegraph.com/t/mapping-relational-field-thegraph/3112/1 "2022-02-19T08:27:07Z")

</div>

Hi,

I have two entities with one to may relationship.

eg:

```auto
//schema.graphql
type Main @entity{
   id: ID! #address of a contract
}

type Another @entity{
   id: ID!
   main: Main! #how to set this field in mapping.ts?
   amount: BigInt!
}

//mapping.ts
another.main = "" #do I pass in address (which is the ID of the Main entity) of the Main contract?

```

I am doubtful on what I should add in the relationship field (`main`) during mapping? do I pass in the ID of the `Main` entity?
