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.
Example:
A table called worker and a table called department. Workers can work in many departments and many workers can work in the same department.
However the workers move between department and we need to store the year that they move into another department.
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?