首页 > 解决方案 > 运行 Firestore 本地模拟器时如何查看数据库数据?

问题描述

我已经设置了 Firebase本地模拟器套件,并让我的 iOS 应用程序访问本地服务器。我想验证某些云功能(在文档写入时)是否按预期执行,但我无法验证数据是否存在。我可以通过运行deploy并检查 Firebase 控制台数据库选项卡来做到这一点,但这只是开发期间的可行解决方案。我想我也可以get从 iOS 客户端做一个,但希望有一种更简单的方法来查看 JSON。

CLI 打印出许多本地 URL,但没有任何我能看到的数据:

✔  hub: emulator hub started at http://localhost:4400
✔  functions: functions emulator started at http://localhost:5001
i  firestore: firestore emulator logging to firestore-debug.log
✔  firestore: firestore emulator started at http://localhost:8080
i  firestore: For testing set FIRESTORE_EMULATOR_HOST=localhost:8080

标签: firebasegoogle-cloud-functions

解决方案


2020 年 5 月 21 日,Firebase 团队推出了模拟器 UI。可用功能之一是 Firestore 和实时数据库的数据管理

基本上你必须确保至少安装了 Firebase CLI 8.4.0 版本

使用 初始化项目后firebase init,您将能够在localhost:4000执行以下命令后在 Web 浏览器中访问 Emulator UI

firebase emulators:start


推荐阅读