I want to write a script that delete the data from all the documents of sub collection where status == expire. I have collection name user_data and this collection contain many documents all that documents contain sub collection name My_status and this My_status contains many documents, each document contains status and if status === expire than delete that data
The database structure is like this
collection - user_data
                     document1 - Subcollection - My_status --document1- Status expire      
                                                             document2 
                                                             document3
                     document2 - Subcollection - My_status --document1 
                                                             document2--Status expire
                                                             document3
I have tried this but this does not work as I can't relate it to sub collection
// First perform the query
db.collection('user_data').where('status','==',expire).get()
.then(function(querySnapshot) {
// Once we get the results, begin a batch
    var batch = db.batch();
    querySnapshot.forEach(function(doc) {
        // For each doc, add a delete operation to the batch
        batch.delete(doc.ref);
    });
    // Commit the batch
    return.batch.commit();
}).then(function() {
  // Delete completed!
  // ...
});