[英]How does Firebase Firestore emulator work?
So far I've been using Firebase Hosting and Functions emulators.到目前为止,我一直在使用 Firebase 托管和功能模拟器。 But now I'm writting a function that will run based on a Firestore trigger, so I'm looking into the Firestore emulator for development.但现在我正在编写一个基于 Firestore 触发器运行的 function,所以我正在研究 Firestore 模拟器进行开发。
But how does it work?但它是如何工作的? Does it mimics Firestore completely?它完全模仿 Firestore 吗? Will I be able to read my current Firestore data that it's saved on server?我能否读取保存在服务器上的当前 Firestore 数据? And what if I update, create or delete change documents, will I be really changing them in my real data as well?如果我更新、创建或删除更改文档,我是否真的会在我的真实数据中更改它们?
I'll run it with:我将运行它:
firebase emulators:start --only hosting,functions,firestore
The Firestore emulator suites gives you just enough functionality to test locally. Firestore 模拟器套件为您提供了足够的功能来进行本地测试。 It is not a full copy of what the cloud services actually do.它不是云服务实际功能的完整副本。
The Firestore emulator does not let you read and write data stored on the server. Firestore 模拟器不允许您读取和写入存储在服务器上的数据。 You have to populate the database locally in order to test locally.您必须在本地填充数据库才能在本地进行测试。
If you want to use data hosted in the cloud service instead, then don't use the emulator - just access your project as normal.如果您想使用托管在云服务中的数据,请不要使用模拟器 - 只需照常访问您的项目即可。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.