Migrations are most commonly used when changing your application code requires some one-time action on the next startup. For example you have a MongoDB collection that uses a User schema which stores data about your users favorite food like:
But you add a new feature to your application that expands this functionality and also allows users to store different favorite things so instead of a string, you would like to store an object with a type value like so:
Now, if you just changed the schema and your application code, but didn’t adjust your existing database data that still stores the values as strings it would create inconsistencies and bugs in your application.
This is what the up function in the Migration is for - there you will write a MongoDB query that will modify your existing documents and turn your string values into appropriate objects. Conversely, you would write the reverse action in the down function - here you want to turn all your objects into strings instead.
Also keep in mind that migrations can do anything - it doesn’t have to be related to your database.
It seems that in the example you provided you are trying to use migrations as a versioning system for your application - this is better done by other tools, for example using git tags.