When adding new functions to a database, how do you normally migrate data if you need to change database fields

  mongodb, question

When adding new functions to a database, how do you normally migrate data if you need to change database fields

Is to change the fields in the table, you look up ALTER TABLE this syntax, use SQL instructions to modify.
Another method is to create a new table, import the old data into the new table, then delete the old table and rename the new table.