简体   繁体   English

Firebase Firestore 模拟器如何工作?

[英]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.

相关问题 如何在Firebase Functions中与Firestore + pdfmake一起使用Promise - How to work with promise with firestore + pdfmake in Firebase Functions 如何设置用于单元测试的测试套件 Firebase 与模拟器连接的功能,特别是 Firestore 模拟器? - How to setup a test suit for unit testing Firebase Functions that connect with emulators, specifically the Firestore emulator? 如何将测试数据从生产中导入 Firebase Firestore 模拟器以便于测试? - How to import test data into Firebase Firestore emulator from production for easy testing? 在本地功能 firebase 仿真器中使用实时/在线 Firestore - Use live/online firestore in local Functions firebase emulator 如何连接到 Firebase Auth 模拟器 - How to connect to Firebase Auth emulator 使用在 Firestore 模拟器上运行的 Firebase-Admin 时找不到 Firestore 文档 - Firestore document not found when using Firebase-Admin running on Firestore Emulator 如何在 firebase 火库中存储列表? - How to store a list in firebase firestore? 如何在 Firebase Firestore 中使用查询 - How to use Query in Firebase Firestore Firebase Firestore Increment FieldValue 不递增 - Firebase Firestore Increment FieldValue does not increment 此文档在 firebase firestore 中不存在错误 - This document does not exist error in firebase firestore
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM