- Most of the Developers responded with: https://github.com/cloudyrock/mongock
- Flyway Equivalent for MongDB
- Migration in Order
@ChangeLog(order = "2")
) - Migration in Java Code
- Spring Data Support
- Example:
@ChangeLog(order = "2")
public class ClientUpdaterChangeLog {
@ChangeSet(id = "data-updater-with-mongockTemplate", order = "001", author = "mongock")
public void dataUpdater(MongockTemplate template) {
List<Client> clients = template.findAll(Client.class, CLIENTS_COLLECTION_NAME);
clients.stream()
.map(client -> client.setName(client.getName() + "_updated"))
.forEach(client -> template.save(client, CLIENTS_COLLECTION_NAME));
}
}