[Solved] Remove value from database using Cloud Functions


You are returning from the function before calling remove. Try:

  return oldItemsQuery.once('value', function(snapshot) {
    // create a map with all children that need to be removed
    var updates = {};
    snapshot.forEach(function(child) {
      updates[child.key] = null
    });
    // execute all updates in one go and return the result to end the function
    return ref.update(updates);
  }).then(function() {;
    return functions.database.ref('/days').remove();
  });

7

solved Remove value from database using Cloud Functions