0

I am trying to create a simple firebase query using nodejs and firebase. Everytime i run this query i keep getting db_coll.where(...).update is not a function . I am not sure what i am doing wrong. Any help would be really appreciated.

Below is mu code.

const db_coll =  db.collection('orders');


db_coll.where('store_id', '==', storeId)
    .update({is_confirmed: 1})
    .then(() => {
        console.log('Documents successfully updated!');
    })
    .catch((error) => {
        console.error('Error updating documents:', error);
    });
Doug Stevenson
  • 297,357
  • 32
  • 422
  • 441
json2021
  • 2,146
  • 2
  • 14
  • 28
  • You can't update all of the documents that would result from a query. You have to perform the query, read and iterate the documents, and update them individually. – Doug Stevenson Jul 17 '23 at 23:29

0 Answers0