skip to Main Content

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


  1. There is no way to do that, You have to use .get or .snapshots to get documents first then get the field value.

    Login or Signup to reply.
  2. 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.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search