title: Many to many relation table field into MongoDB
body: <p>While doing a many to many relationship in SQL we create a table that will have the ID of the 2 tables that are forming the relationship. Sometimes in that table that we are creating, we put more data.</p>
  <p>Example:</p>
  <p>A table called worker and a table called department. Workers can work in many departments and many workers can work in the same department.</p>
  <p>However the workers move between department and we need to store the year that they move into another department.</p>
  <p>In mongoDB how can we represent that year. I am creating id for every worker and adding the department where they have worked but how do I store the year?</p>
  <p>How to represente the WantedField.</p>
  <p><a href="https://i.stack.imgur.com/PxLwI.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/PxLwI.png" alt="enter image description here" /></a></p>