Simply I have the following query method:
FirebaseFirestore.instance.collection('users')
.where('count', isEqualTo: // here I need to use the current field value + 50 for example){...}
Is there a way to do that in the same query?
Simply I have the following query method:
FirebaseFirestore.instance.collection('users')
.where('count', isEqualTo: // here I need to use the current field value + 50 for example){...}
Is there a way to do that in the same query?
2
Answers
There is no way to do that, You have to use
.get
or.snapshots
to get documents first then get the field value.Yes, you can use a transaction. Transactions are helpful when you want to update the value of a field based on its current value. This means that when you perform a transaction, you can read the value in the field first, then you can perform some logic and in the end, you can finally commit the transaction.