Q:

Update Firebase document based on custom fields

I got the following Firebase document:
{
  "customField1": "customValue1",
  "customField2": "customValue2",
  "fieldToChange: "valueToChange"
}

I wish to know how to do two operations:

Find the document which has "customField1" set to "customValue1" and update "valueToChange" to something else.
Find the document which has "customField1" set to "customValue1" AND "customField2" set to "customValue2" and update "valueToChange" to something else.

How can I achieve this?
I only see options where you need the docId:
const uploadCollection = this.db.collection<any>('uploads');
    return await uploadCollection.doc(docId).update({ 'fieldToChange': 'another value' });

A:

Some form of this is probably what you're looking for:
var uploads = db.collection("uploads").where("customField1", "==", "customValue1");

uploads.get().then(querySnapshot => {
    querySnapshot.forEach(doc => {
        doc.ref.update({ 'fieldToChange': 'another value' });
    });
});

see here for more info: https://firebase.google.com/docs/firestore/query-data/queries

