【发布时间】:2018-10-19 14:56:21
【问题描述】:
我正在尝试清除一个 Firestore 数据库,该数据库中包含大量文档和子集合以进行测试。 Firebase CLI (firebase-tools@3.18.4) 建议从 Cloud Firestore 中删除数据的可能性如下:
用法: firestore:delete [options] [path]
选项:
-r, --recursive Recursive. Delete all documents and subcollections. Any action which would result in the deletion of child documents will fail if this argument is not passed. May not be passed along with --shallow.
--shallow Shallow. Delete only parent documents and ignore documents in subcollections. Any action which would orphan documents will fail if this argument is not passed. May not be passed along with -r.
--all-collections Delete all. Deletes the entire Firestore database, including all collections and documents. Any other flags or arguments will be ignored.
-y, --yes No confirmation. Otherwise, a confirmation prompt will appear.
问题是它对我不起作用。
执行firebase firestore:delete --all-collections 会产生以下输出:
You are about to delete YOUR ENTIRE DATABASE. Are you sure? Yes
Deleting the following collections: 13OPlWrRit5PoaAbM0Rk, 17lHmJpTKVn1MBBbC169, 18LvlhhaCA1tygJYqIDt, 1DgDspzJwSEZrYxeM5G6, 1GQE7ySki4MhXxAeAzpx, 1MhoDe5JZY8Lz3yd7rVl, 1NOZ7OJeqSKl38dyh5Sw, 1Rxkjpgmr3gKvYhBJX29, 1S3mAhzQMd137Eli7qAp, 1S8FZxuefpIWBGx0hJW2, 1a7viEplYa79eNNus5xC, 1cgzMxAayzSkZv2iZf6e, 1dGjESrw6j12hEOqMpky, 1dbfgFD5teTXvQ6Ym897, 1eeYQgv2BJIS0aFWPksD, 1ehWNAZ0uKwg7mPXt3go, 1fDTkbwrXmGwZlFUl3zi, 1k5bk4aiMCuPw2KvCoAl, 1pxUSDh1YqkQAcuUH9Ie, 1rMSZ5Ru0cAfdcjY0Ljy
Deleted 92 docs (652 docs/s)
即使在多次执行该函数后,仍有大量文档和子集合保留在 Firestore 数据库中。不是删除ENTIRE DATABASE,而是在执行命令时只删除了大约70-150个文档。
如何删除整个数据库?
【问题讨论】:
-
如果 CLI 显然没有达到您的预期,请提交错误报告:firebase.google.com/support/contact/bugs-features
标签: firebase google-cloud-firestore firebase-cli