Javascript代码没有给出任何结果

时间:2017-06-30 07:09:55

标签: javascript google-cloud-functions

包含1个以上孩子的days个节点未被删除。我该如何解决这个问题?

const theRef = event.data.ref;
const collectionRef = theRef.parent.child('days');
return collectionRef;
collectionRef.once('value').then(messagesData => {
  if(messagesData.numChildren() > 1) {
    let updates = {};
    updates['/days'] = null;
    return defaultDatabase.ref().update(updates); // 'days' doesn't get removed even if it has more than 1 child (as in the image)!
  } 
});

数据结构:

enter image description here

1 个答案:

答案 0 :(得分:0)

是不是因为你需要在最后一次在collectionref上调用之前返回collectionRef?这样:

def there_is_an_alert_after_seconds(self, seconds):
    ...