How to remove data from Firestore using cloud functions

I am writing cloud functions with the Google Firestore database.

I am trying to write recursively deleting more data. I cannot find syntax for accessing and deleting data in other parts of the database. The code that I already have is below.

exports.deleteProject = functions.firestore.document('{userID}/projects/easy/{projectID}').onDelete(event => {
    // Get an object representing the document prior to deletion
    // e.g. {'name': 'Marie', 'age': 66}
    // console.log(event)
    // console.log(event.data)
    console.log(event.data.previous.data())

    var deletedValue = event.data.previous.data();

});

I found some information here, but I don’t have time to check it, if I find something useful, I will fix the issue.

https://firebase.google.com/docs/firestore/manage-data/delete-data?authuser=0

+4
source share
1 answer

, , . . , , , .

0

Source: https://habr.com/ru/post/1689033/


All Articles