使用Firebase Python管理SDK进行批删除

2024-09-29 17:18:13 发布

您现在位置:Python中文网/ 问答频道 /正文

Firebase Python管理SDK有一个bulk ^{}方法,但是不能像Javascript管理SDK中的批量删除那样使用它,因为您不能有Nonedict值(SDKvalidation)。在

SDK文档很少,几乎没有可用的示例。有人知道如何在Python中批删除吗?在

Javascript中批量删除的Example

const parentRef = db.reference('parent/foo/')
const children = parentRef.get()
const updates = {};

Object.keys(children).forEach( childKey => {

  const childEntry = children(childKey)
  if( shouldDelete(childEntry) ) {
    updates[childKey] = null; // setting value to null deletes the key
  }
}
parentRef.update(updates);

Tags: 方法sdkbulk批量javascriptnullchildrenfirebase

热门问题