I have a simple question: How can I update a field in a firestore document when the field name is only known dynamically through a variable?
const myCounterName = "exampleName";
const docRef = admin.firestore().collection("metadata").doc("myDoc");
docRef.set({myCounterName : admin.firestore.FieldValue.increment(1)}, {merge: true});
The challenge lies in the fact that Firestore interprets the field I want to change as "myCounterName" rather than "exampleName".