Здравствуйте, я пытаюсь вызвать подколлекции в документе, вот мой код,
exports.updateCounter = functions.firestore
.document('journeys/{journeyId}/{collectionId}/{id}')
.onWrite((change, context) => {
const docRef = change.after.ref;
const collectionId = context.params.collectionId;
const eventType = context.eventType;
const uid = context.auth.uid;
console.log("Update Counter called!");
console.log("Event type: "+ eventType);
console.log("Userid: " + uid);
});
Но, похоже, функция не срабатывает, Моя база данных выглядит примерно так:
путешествия / {id} / комментарий / {commentid} / лайк / {likeid}
путешествия / {id} / комментарий / {commentid} / likeshard / {shardId}
Когда {shardId} или {likeid} функция не запущена
вот мои правила
match /journeys/{journey} {
allow read, write: if request.auth.uid != null;
allow delete: if request.auth.uid == resource.data.author_id;
match /comment/{document=**}{
allow read, update, delete, create: if request.auth.uid != null;
}
и при развертывании функции:
i deploying functions
i functions: ensuring necessary APIs are enabled...
+ functions: all necessary APIs are enabled
i functions: preparing functions directory for uploading...
i functions: packaged functions (41.41 KB) for uploading
+ functions: functions folder uploaded successfully
i functions: uploading functions in project: updateCounter(us-central1)
i functions: updating Node.js 6 function updateCounter(us-central1)...
+ functions[updateCounter(us-central1)]: Successful update operation.
+ Deploy complete!