如何在Firebase实时数据库中执行大型删除

如何在Firebase实时数据库中执行大型删除,firebase,firebase-realtime-database,firebase-cli,Firebase,Firebase Realtime Database,Firebase Cli,我正在使用Firebase实时数据库。我想删除一个有大量记录的节点。所以我不能用正常的方式删除。当我尝试使用rest删除时,我不能这样做。默认设置为“大”。我必须将defaultWriteSizeLimit设置为“无限” 以下是firebase-debug.log: [debug] [2020-12-09T09:24:13.317Z] ---------------------------------------------------------------------- [debug] [2

我正在使用Firebase实时数据库。我想删除一个有大量记录的节点。所以我不能用正常的方式删除。当我尝试使用rest删除时,我不能这样做。默认设置为“大”。我必须将defaultWriteSizeLimit设置为“无限”

以下是firebase-debug.log:

[debug] [2020-12-09T09:24:13.317Z] ----------------------------------------------------------------------
[debug] [2020-12-09T09:24:13.318Z] Command:       /usr/local/lib/node_modules/firebase-tools/lib/bin/firebase.js /Users/emrekhan/.cache/firebase/tools/lib/node_modules/firebase-tools/lib/bin/firebase database:settings:set defaultWriteSizeLimit unlimited --instance dbname
[debug] [2020-12-09T09:24:13.318Z] CLI Version:   8.17.0
[debug] [2020-12-09T09:24:13.318Z] Platform:      darwin
[debug] [2020-12-09T09:24:13.318Z] Node Version:  v12.18.1
[debug] [2020-12-09T09:24:13.319Z] Time:          Wed Dec 09 2020 12:24:13 GMT+0300 (GMT+03:00)
[debug] [2020-12-09T09:24:13.319Z] ----------------------------------------------------------------------
[debug] [2020-12-09T09:24:13.319Z] 
[debug] [2020-12-09T09:24:13.322Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
[debug] [2020-12-09T09:24:13.323Z] > authorizing via signed-in user
[debug] [2020-12-09T09:24:13.324Z] [iam] checking project dbname for permissions ["firebase.projects.get","firebasedatabase.instances.update"]
[debug] [2020-12-09T09:24:13.325Z] > refreshing access token with scopes: ["email","https://www.googleapis.com/auth/cloud-platform","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","openid"]
[debug] [2020-12-09T09:24:13.325Z] >>> HTTP REQUEST POST https://www.googleapis.com/oauth2/v3/token  
 <request body omitted>
[debug] [2020-12-09T09:24:13.668Z] <<< HTTP RESPONSE 200 {"date":"Wed, 09 Dec 2020 09:24:14 GMT","expires":"Mon, 01 Jan 1990 00:00:00 GMT","pragma":"no-cache","cache-control":"no-cache, no-store, max-age=0, must-revalidate","content-type":"application/json; charset=utf-8","vary":"X-Origin, Referer, Origin,Accept-Encoding","server":"scaffolding on HTTPServer2","x-xss-protection":"0","x-frame-options":"SAMEORIGIN","x-content-type-options":"nosniff","alt-svc":"h3-29=\":443\"; ma=2592000,h3-T051=\":443\"; ma=2592000,h3-Q050=\":443\"; ma=2592000,h3-Q046=\":443\"; ma=2592000,h3-Q043=\":443\"; ma=2592000,quic=\":443\"; ma=2592000; v=\"46,43\"","accept-ranges":"none","transfer-encoding":"chunked"}
[debug] [2020-12-09T09:24:13.682Z] >>> HTTP REQUEST POST https://cloudresourcemanager.googleapis.com/v1/projects/dbname:testIamPermissions  
 {"permissions":["firebase.projects.get","firebasedatabase.instances.update"]}
[debug] [2020-12-09T09:24:14.782Z] <<< HTTP RESPONSE 200 {"content-type":"application/json; charset=UTF-8","vary":"X-Origin, Referer, Origin,Accept-Encoding","date":"Wed, 09 Dec 2020 09:24:15 GMT","server":"ESF","cache-control":"private","x-xss-protection":"0","x-frame-options":"SAMEORIGIN","x-content-type-options":"nosniff","server-timing":"gfet4t7; dur=768","alt-svc":"h3-29=\":443\"; ma=2592000,h3-T051=\":443\"; ma=2592000,h3-Q050=\":443\"; ma=2592000,h3-Q046=\":443\"; ma=2592000,h3-Q043=\":443\"; ma=2592000,quic=\":443\"; ma=2592000; v=\"46,43\"","accept-ranges":"none","transfer-encoding":"chunked"}
[debug] [2020-12-09T09:24:14.783Z] >>> HTTP REQUEST GET https://firebasedatabase.googleapis.com/v1beta/projects/dbname/locations/-/instances/dbname
 
[debug] [2020-12-09T09:24:15.499Z] <<< HTTP RESPONSE 200 {"content-type":"application/json; charset=UTF-8","vary":"X-Origin, Referer, Origin,Accept-Encoding","date":"Wed, 09 Dec 2020 09:24:16 GMT","server":"ESF","cache-control":"private","x-xss-protection":"0","x-frame-options":"SAMEORIGIN","x-content-type-options":"nosniff","alt-svc":"h3-29=\":443\"; ma=2592000,h3-T051=\":443\"; ma=2592000,h3-Q050=\":443\"; ma=2592000,h3-Q046=\":443\"; ma=2592000,h3-Q043=\":443\"; ma=2592000,quic=\":443\"; ma=2592000; v=\"46,43\"","accept-ranges":"none","transfer-encoding":"chunked"}
[debug] [2020-12-09T09:24:15.501Z] > refreshing access token with scopes: []
[debug] [2020-12-09T09:24:15.501Z] >>> HTTP REQUEST POST https://www.googleapis.com/oauth2/v3/token  
 <request body omitted>
[debug] [2020-12-09T09:24:15.766Z] <<< HTTP RESPONSE 200 {"date":"Wed, 09 Dec 2020 09:24:16 GMT","cache-control":"no-cache, no-store, max-age=0, must-revalidate","expires":"Mon, 01 Jan 1990 00:00:00 GMT","pragma":"no-cache","content-type":"application/json; charset=utf-8","vary":"X-Origin, Referer, Origin,Accept-Encoding","server":"scaffolding on HTTPServer2","x-xss-protection":"0","x-frame-options":"SAMEORIGIN","x-content-type-options":"nosniff","alt-svc":"h3-29=\":443\"; ma=2592000,h3-T051=\":443\"; ma=2592000,h3-Q050=\":443\"; ma=2592000,h3-Q046=\":443\"; ma=2592000,h3-Q043=\":443\"; ma=2592000,quic=\":443\"; ma=2592000; v=\"46,43\"","accept-ranges":"none","transfer-encoding":"chunked"}
[debug] [2020-12-09T09:24:15.780Z] >>> [apiv2][query] PUT https://dbname.firebaseio.com/.settings/defaultWriteSizeLimit.json [none]
[debug] [2020-12-09T09:24:15.780Z] >>> [apiv2][body] PUT https://dbname.firebaseio.com/.settings/defaultWriteSizeLimit.json "unlimited"
[debug] [2020-12-09T09:24:16.568Z] <<< [apiv2][status] PUT https://dbname.firebaseio.com/.settings/defaultWriteSizeLimit.json 400
[debug] [2020-12-09T09:24:16.568Z] <<< [apiv2][body] PUT https://dbname.firebaseio.com/.settings/defaultWriteSizeLimit.json {"error":"defaultWriteSizeLimit should be one of {\"large\", \"medium\", \"small\", \"unlimited\"}"}
[debug] [2020-12-09T09:24:16.907Z] FirebaseError: HTTP Error: 400, defaultWriteSizeLimit should be one of {"large", "medium", "small", "unlimited"}
    at module.exports (/Users/emrekhan/.cache/firebase/tools/lib/node_modules/firebase-tools/lib/responseToError.js:38:12)
    at Client.<anonymous> (/Users/emrekhan/.cache/firebase/tools/lib/node_modules/firebase-tools/lib/apiv2.js:191:27)
    at Generator.next (<anonymous>)
    at fulfilled (/Users/emrekhan/.cache/firebase/tools/lib/node_modules/firebase-tools/lib/apiv2.js:5:58)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
[error] 
[error] Error: Unexpected error fetching configs at defaultWriteSizeLimit
[debug][2020-12-09T09:24:13.317Z]----------------------------------------------------------------------
[debug][2020-12-09T09:24:13.318Z]命令:/usr/local/lib/node_modules/firebase tools/lib/bin/firebase.js/Users/emrekhan/.cache/firebase/tools/lib/node_modules/lib/bin/firebase数据库:设置:设置defaultWriteSizeLimit unlimit——实例dbname
[调试][2020-12-09T09:24:13.318Z]CLI版本:8.17.0
[调试][2020-12-09T09:24:13.318Z]平台:达尔文
[调试][2020-12-09T09:24:13.318Z]节点版本:v12.18.1
[调试][2020-12-09T09:24:13.319Z]时间:周三,2020年12月9日12:24:13 GMT+0300(GMT+03:00)
[调试][2020-12-09T09:24:13.319Z]----------------------------------------------------------------------
[调试][2020-12-09T09:24:13.319Z]
[debug][2020-12-09T09:24:13.322Z]>命令需要作用域:[“email”、“openid”和https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
[调试][2020-12-09T09:24:13.323Z]>通过登录用户进行授权
[debug][2020-12-09T09:24:13.324Z][iam]正在检查project dbname的权限[“firebase.projects.get”,“firebasedatabase.instances.update”]
[debug][2020-12-09T09:24:13.325Z]>正在刷新作用域为:[“电子邮件”的访问令牌https://www.googleapis.com/auth/cloud-platform","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase“,“openid”]
[调试][2020-12-09T09:24:13.325Z]>>>HTTP请求发布https://www.googleapis.com/oauth2/v3/token  
[调试][2020-12-09T09:24:13.668Z]>HTTP请求发布https://cloudresourcemanager.googleapis.com/v1/projects/dbname:testIamPermissions  
{“权限”:[“firebase.projects.get”,“firebasedatabase.instances.update”]}
[调试][2020-12-09T09:24:14.782Z]>HTTP请求获取https://firebasedatabase.googleapis.com/v1beta/projects/dbname/locations/-/instances/dbname
[调试][2020-12-09T09:24:15.499Z]>>HTTP请求发布https://www.googleapis.com/oauth2/v3/token  
[调试][2020-12-09T09:24:15.766Z]>[apiv2][query]PUThttps://dbname.firebaseio.com/.settings/defaultWriteSizeLimit.json [无]
[debug][2020-12-09T09:24:15.780Z]>>>>[apiv2][body]PUThttps://dbname.firebaseio.com/.settings/defaultWriteSizeLimit.json “无限”

[debug][2020-12-09T09:24:16.568Z]我通过修补
firebase工具
:在
数据库/settings.js中,我用
返回JSON.stringify(输入)
替换了第23行,并成功更新了设置

并在今天的

我假设我们可以期待firebase tools上的版本升级,然后运行

firebase database:settings:set defaultWriteSizeLimit unlimited

更新到最新版本后应该可以工作。

firebaser这里我不确定那里发生了什么。您可能希望在疑难解答中获得个性化帮助。Firebase支持是否解决了您的问题?我在同一个日志中遇到了完全相同的问题。我也遇到了同样的问题,但没有出路–@FrankvanPuffelen也许你能帮上忙?我通过修补
firebase tools
:在
数据库/settings.js
中,我将第23行替换为“return JSON.stringify(input)”并且成功地更新了设置。@MishaReyzlin如果可以,您可以将您的评论作为答案发布吗
[debug] [2020-12-09T09:24:13.317Z] ----------------------------------------------------------------------
[debug] [2020-12-09T09:24:13.318Z] Command:       /usr/local/lib/node_modules/firebase-tools/lib/bin/firebase.js /Users/emrekhan/.cache/firebase/tools/lib/node_modules/firebase-tools/lib/bin/firebase database:settings:set defaultWriteSizeLimit unlimited --instance dbname
[debug] [2020-12-09T09:24:13.318Z] CLI Version:   8.17.0
[debug] [2020-12-09T09:24:13.318Z] Platform:      darwin
[debug] [2020-12-09T09:24:13.318Z] Node Version:  v12.18.1
[debug] [2020-12-09T09:24:13.319Z] Time:          Wed Dec 09 2020 12:24:13 GMT+0300 (GMT+03:00)
[debug] [2020-12-09T09:24:13.319Z] ----------------------------------------------------------------------
[debug] [2020-12-09T09:24:13.319Z] 
[debug] [2020-12-09T09:24:13.322Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
[debug] [2020-12-09T09:24:13.323Z] > authorizing via signed-in user
[debug] [2020-12-09T09:24:13.324Z] [iam] checking project dbname for permissions ["firebase.projects.get","firebasedatabase.instances.update"]
[debug] [2020-12-09T09:24:13.325Z] > refreshing access token with scopes: ["email","https://www.googleapis.com/auth/cloud-platform","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","openid"]
[debug] [2020-12-09T09:24:13.325Z] >>> HTTP REQUEST POST https://www.googleapis.com/oauth2/v3/token  
 <request body omitted>
[debug] [2020-12-09T09:24:13.668Z] <<< HTTP RESPONSE 200 {"date":"Wed, 09 Dec 2020 09:24:14 GMT","expires":"Mon, 01 Jan 1990 00:00:00 GMT","pragma":"no-cache","cache-control":"no-cache, no-store, max-age=0, must-revalidate","content-type":"application/json; charset=utf-8","vary":"X-Origin, Referer, Origin,Accept-Encoding","server":"scaffolding on HTTPServer2","x-xss-protection":"0","x-frame-options":"SAMEORIGIN","x-content-type-options":"nosniff","alt-svc":"h3-29=\":443\"; ma=2592000,h3-T051=\":443\"; ma=2592000,h3-Q050=\":443\"; ma=2592000,h3-Q046=\":443\"; ma=2592000,h3-Q043=\":443\"; ma=2592000,quic=\":443\"; ma=2592000; v=\"46,43\"","accept-ranges":"none","transfer-encoding":"chunked"}
[debug] [2020-12-09T09:24:13.682Z] >>> HTTP REQUEST POST https://cloudresourcemanager.googleapis.com/v1/projects/dbname:testIamPermissions  
 {"permissions":["firebase.projects.get","firebasedatabase.instances.update"]}
[debug] [2020-12-09T09:24:14.782Z] <<< HTTP RESPONSE 200 {"content-type":"application/json; charset=UTF-8","vary":"X-Origin, Referer, Origin,Accept-Encoding","date":"Wed, 09 Dec 2020 09:24:15 GMT","server":"ESF","cache-control":"private","x-xss-protection":"0","x-frame-options":"SAMEORIGIN","x-content-type-options":"nosniff","server-timing":"gfet4t7; dur=768","alt-svc":"h3-29=\":443\"; ma=2592000,h3-T051=\":443\"; ma=2592000,h3-Q050=\":443\"; ma=2592000,h3-Q046=\":443\"; ma=2592000,h3-Q043=\":443\"; ma=2592000,quic=\":443\"; ma=2592000; v=\"46,43\"","accept-ranges":"none","transfer-encoding":"chunked"}
[debug] [2020-12-09T09:24:14.783Z] >>> HTTP REQUEST GET https://firebasedatabase.googleapis.com/v1beta/projects/dbname/locations/-/instances/dbname
 
[debug] [2020-12-09T09:24:15.499Z] <<< HTTP RESPONSE 200 {"content-type":"application/json; charset=UTF-8","vary":"X-Origin, Referer, Origin,Accept-Encoding","date":"Wed, 09 Dec 2020 09:24:16 GMT","server":"ESF","cache-control":"private","x-xss-protection":"0","x-frame-options":"SAMEORIGIN","x-content-type-options":"nosniff","alt-svc":"h3-29=\":443\"; ma=2592000,h3-T051=\":443\"; ma=2592000,h3-Q050=\":443\"; ma=2592000,h3-Q046=\":443\"; ma=2592000,h3-Q043=\":443\"; ma=2592000,quic=\":443\"; ma=2592000; v=\"46,43\"","accept-ranges":"none","transfer-encoding":"chunked"}
[debug] [2020-12-09T09:24:15.501Z] > refreshing access token with scopes: []
[debug] [2020-12-09T09:24:15.501Z] >>> HTTP REQUEST POST https://www.googleapis.com/oauth2/v3/token  
 <request body omitted>
[debug] [2020-12-09T09:24:15.766Z] <<< HTTP RESPONSE 200 {"date":"Wed, 09 Dec 2020 09:24:16 GMT","cache-control":"no-cache, no-store, max-age=0, must-revalidate","expires":"Mon, 01 Jan 1990 00:00:00 GMT","pragma":"no-cache","content-type":"application/json; charset=utf-8","vary":"X-Origin, Referer, Origin,Accept-Encoding","server":"scaffolding on HTTPServer2","x-xss-protection":"0","x-frame-options":"SAMEORIGIN","x-content-type-options":"nosniff","alt-svc":"h3-29=\":443\"; ma=2592000,h3-T051=\":443\"; ma=2592000,h3-Q050=\":443\"; ma=2592000,h3-Q046=\":443\"; ma=2592000,h3-Q043=\":443\"; ma=2592000,quic=\":443\"; ma=2592000; v=\"46,43\"","accept-ranges":"none","transfer-encoding":"chunked"}
[debug] [2020-12-09T09:24:15.780Z] >>> [apiv2][query] PUT https://dbname.firebaseio.com/.settings/defaultWriteSizeLimit.json [none]
[debug] [2020-12-09T09:24:15.780Z] >>> [apiv2][body] PUT https://dbname.firebaseio.com/.settings/defaultWriteSizeLimit.json "unlimited"
[debug] [2020-12-09T09:24:16.568Z] <<< [apiv2][status] PUT https://dbname.firebaseio.com/.settings/defaultWriteSizeLimit.json 400
[debug] [2020-12-09T09:24:16.568Z] <<< [apiv2][body] PUT https://dbname.firebaseio.com/.settings/defaultWriteSizeLimit.json {"error":"defaultWriteSizeLimit should be one of {\"large\", \"medium\", \"small\", \"unlimited\"}"}
[debug] [2020-12-09T09:24:16.907Z] FirebaseError: HTTP Error: 400, defaultWriteSizeLimit should be one of {"large", "medium", "small", "unlimited"}
    at module.exports (/Users/emrekhan/.cache/firebase/tools/lib/node_modules/firebase-tools/lib/responseToError.js:38:12)
    at Client.<anonymous> (/Users/emrekhan/.cache/firebase/tools/lib/node_modules/firebase-tools/lib/apiv2.js:191:27)
    at Generator.next (<anonymous>)
    at fulfilled (/Users/emrekhan/.cache/firebase/tools/lib/node_modules/firebase-tools/lib/apiv2.js:5:58)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
[error] 
[error] Error: Unexpected error fetching configs at defaultWriteSizeLimit
firebase database:settings:set defaultWriteSizeLimit unlimited