I am using Spring Data over MongoDB. I was able to save POJO, update them. It works great. But now I want to dump in db only changed POJO fields.
For example, I have a custom object. I create a user and then update lastActiveDate from time to time.
@Document
class User {
@Id
BigInteger ID;
String email;
String name;
Date lastActiveDate;
}
User user = new User();
user.setName("User");
user.setEmail("example@example.com");
repository.save(user);
User toUpdUser = repository.findOne(userId);
toUpdUser.setLastActiveDate(new Date);
repository.save(toUpdUser );
In the second save, I want to update only the lastActiveDate field of the whole user, because updating documents can slow down on large objects. I also want to know a set of changes (at least a set of updated fields).
API . , ( ), . - beans , IFAIK Spring Data POJO Spring bean , POJO AOP POJO.
UPD:
mongo api ( mongo-like api). , . . - 5 0,2
, POJO-mappers CRUD, , . SpringData.