Массовые обновления поддерживаются из spring-data-mongodb начиная с 1.9.0.RELEASE.
BulkOperations ops = template.bulkOps(BulkMode.UNORDERED, Match.class);
for (User user : users) {
Update update = new Update();
...
ops.updateOne(query(where("id").is(user.getId())), update);
}
ops.execute();
mongoTemplate имеет функцию с именем void save(Object objectToSave); Я хочу вставить/обновить всю запись, а не отдельные поля. Есть ли способ или функция, с помощью которой я могу аннулировать класс Update?
Может как-то так..?
BulkOperations ops = template.bulkOps(BulkMode.UNORDERED, Match.class);
for (User user : users) {
...
ops.save(query(where("id").is(user.getId())), user);
}
ops.execute();