У меня есть следующая транзакция, использующая Firestore:
mDb.runTransaction(new Transaction.Function<Void>() {
@Override
public Void apply(final Transaction transaction) throws FirebaseFirestoreException {
DocumentReference documentReference = mDb.collection("collectionOne").document("documentOne");
/*
some code
*/
transaction.update(documentReference, App.getResourses().getString(R.string.field_one), FieldValue.increment(1));
transaction.update(documentReference, App.getResourses().getString(R.string.field_two), FieldValue.increment(1));
return null;
}
}).addOnSuccessListener(new OnSuccessListener<Void>() {
@Override
public void onSuccess(Void aVoid) {
Log.d("Debugging", "Transaction correctly executed.");
}
}).addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception e) {
Log.w("Debugging", "Transaction failure.", e);
}
});
Мой вопрос: при обновлении, например, двух полей одного и того же документа в рамках одной транзакции, такая транзакция приведет к одной или двумдокументы читает?