I am facing the issue when running the runTransaction func to update values, this func deletes values from a class when the classes are different Let me try to explain
its about my userModel class App version 1.0 has user Model with following attributes
-username -uid -followers
App version 1.1 has user Model with following attributes -username -uid -followers
- status (ADDED)
so the userModel has one additional attribute
when a user using appVersion 1.0 now runs a transaction on a user who uses appVersion 1.1 (e.g when following, I increase the followers by 1), the transaction done by user 1.0 only sets the value it has in its current version, therefore deleting the STATUS of user with version 1.1
my code
API.ref.databaseSpecificUser(id).runTransaction(new Transaction.Handler() {
@Override
public Transaction.Result doTransaction(final MutableData mutableData) {
final User user = mutableData.getValue(User);
if (user== null) {
return Transaction.success(mutableData);
}
.....
mutableData.setValue(user);
return Transaction.success(mutableData);
}
the
mutableData.setValue(user);
Updates the values but does not set the status as app version 1.0 does not contain "STATUS" in they userModel class
any idea?