Situation: have two mongo DBs for project. Each document in DB contains _id and _class fields. After updates in a project I need change _class field in all documents. That is some kind of migration.
I'm thinking about implementing this migration script into WEB part of the project, while deploying script should update all documents.
Info:
1) Script should run only once during deploying.
2) I'm using Spring data framework
Question: I have no clue how to run migration script only once. Is it possible to do using Spring framework? And what is most efficient way to do it?