I try to update all documents in a collection with a Cloud Function. With this code it worked for updating one document (with the id 0) in the collection releasedQuestions:
exports.decreaseQuestionRestDuration = functions.https.onRequest((request, response) => {
const test = admin.firestore().doc('releasedQuestions/0').update({restDuration: 42})
.then(snapshot => {
response.send(0)
})
.catch(error => {
console.log(error)
response.status(500).send(error)
})
});
but when i will update all documents in the collection with a wildcard path like this:
const test = admin.firestore().doc('releasedQuestions/{qid}').update({restDuration: 42})
it doesn't work. Can anyone help me?
My Cloud Firestore structure is this: Cloud Firestore structure