现已推出具有 MongoDB 兼容性的 Firestore 企业版!
了解详情。
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
Cloud Firestore
plat_ios
plat_android
plat_web
plat_flutter
plat_cpp
plat_unity
plat_node
plat_java
plat_python
plat_go
使用我們彈性且可擴充的 NoSQL 雲端資料庫
Google Cloud 基礎架構上,可用來儲存及同步處理用戶端與
伺服器端開發作業
Cloud Firestore 是可擴充的彈性資料庫,適用於行動、網頁、
以及 Firebase 和 Google Cloud 提供的伺服器開發服務喜歡
Firebase Realtime Database,這項服務會透過以下功能將各用戶端應用程式的資料保持同步:
即時接聽程式,並提供行動與網頁的離線支援,
建構回應式應用程式,在網路延遲或網際網路的情況下運作
以獲得最佳效能和最安全的連線Cloud Firestore 也能與其他 Firebase 完美整合
和 Google Cloud 產品,包括 Cloud Functions
開始
主要功能
彈性 |
Cloud Firestore 資料模型支援靈活的階層式資料結構。
將資料儲存在文件中,並整理成集合。文件
除了子集合外,也可能含有複雜的巢狀物件。
|
表達形式的查詢 |
在 Cloud Firestore 中,您可以使用查詢擷取個別或
某個文件集中的所有文件,或某個集合中的所有文件
比對查詢參數查詢可包含多個鏈結
篩選器,以及篩選與排序功能根據預設,這些索引也已編入索引
因此,查詢效能與結果集大小成正比
資料集
|
即時更新 |
和 Realtime Database 一樣,Cloud Firestore 會使用資料同步處理功能更新以下項目的資料:
所有連結裝置。但它也能簡化一次性的
有效擷取查詢。
|
支援離線使用 |
Cloud Firestore 會快取應用程式經常使用的資料,因此應用程式可以寫入
讀取、聆聽及查詢資料,即使裝置未連上網路也沒問題。當
裝置已恢復連線,Cloud Firestore 會將所有本機變更
至 Cloud Firestore。
|
可彈性調整 |
Cloud Firestore 搭載 Google Cloud 強大的功能,
基礎架構:自動多區域資料複寫
一致性保證、不可分割的批次作業以及真實交易
聯絡。我們設計了 Cloud Firestore,能處理最棘手的資料庫
適用於各種工作負載
|
運作原理

Cloud Firestore 是雲端託管的 NoSQL 資料庫,是 Apple、Android 和網頁版服務
應用程式可以直接透過原生 SDK 存取。另有 Cloud Firestore 人參與
原生 Node.js、Java、Python、Unity、C++、Go SDK
RPC API。
遵循 Cloud Firestore 的 NoSQL 資料模型,您可以將資料儲存在符合以下條件的文件:
包含對應至值的欄位。這些文件會儲存在
「集合」是文件專用的容器
整理資料及建立查詢文件可支援
「資料類型」,從簡單的字串和數字到
複雜的巢狀物件您也可以在子集合中建立
並建立階層式資料結構
隨著資料庫不斷發展Cloud Firestore 資料模型支援
最適合您的應用程式
此外,Cloud Firestore 中的查詢方式豐富、有效率且富有彈性,
建立淺層查詢即可在文件層級擷取資料,完全不需要
擷取整個集合或任何巢狀子集合新增排序功能
篩選,以及限制您的查詢或遊標
分頁結果。確保應用程式中的資料符合現況,但不擷取
整個資料庫進行更新,因此請新增即時事件監聽器。
在應用程式中新增即時事件監聽器,每當有資料快照時,您就會收到通知
用戶端應用程式監聽變更的資料,只會擷取新的
並輸入變更內容
使用 Firebase Authentication 和 Cloud Firestore 保護資料的存取
Cloud Firestore Security Rules 適用於 Android、Apple 平台,以及 JavaScript 或 Identity
以及適用於伺服器端語言的 Access Management (IAM)
實作路徑
|
整合 Cloud Firestore SDK |
透過 Gradle、CocoaPods 或指令碼包括快速新增用戶端。 |
|
確保資料安全 |
使用 Cloud Firestore Security Rules 或 Identity and Access Management (IAM) 確保安全
分別為行動/網頁及伺服器開發資料。 |
|
新增資料 |
在資料庫中建立文件和集合。 |
|
取得資料 |
您可以建立查詢或使用即時事件監聽器,從
資料庫 |
後續步驟
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-08-17 (世界標準時間)。
[null,null,["上次更新時間:2025-08-17 (世界標準時間)。"],[],[],null,["Cloud Firestore \nplat_ios plat_android plat_web plat_flutter plat_cpp plat_unity plat_node plat_java plat_python plat_go \nUse our flexible, scalable NoSQL cloud database, built\non Google Cloud infrastructure, to store and sync data for client- and\nserver-side development. \n\nCloud Firestore is a flexible, scalable database for mobile, web,\nand server development from Firebase and Google Cloud. Like\nFirebase Realtime Database, it keeps your data in sync across client apps through\nrealtime listeners and offers offline support for mobile and web so you can\nbuild responsive apps that work regardless of network latency or Internet\nconnectivity. Cloud Firestore also offers seamless integration with other Firebase\nand Google Cloud products, including Cloud Functions.\n\n[Get started](/docs/firestore/quickstart)\n\nKey capabilities\n\n|---------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Flexibility | The Cloud Firestore data model supports flexible, hierarchical data structures. Store your data in documents, organized into collections. Documents can contain complex nested objects in addition to subcollections. |\n| Expressive querying | In Cloud Firestore, you can use queries to retrieve individual, specific documents or to retrieve all the documents in a collection that match your query parameters. Your queries can include multiple, chained filters and combine filtering and sorting. They're also indexed by default, so query performance is proportional to the size of your result set, not your data set. |\n| Realtime updates | Like Realtime Database, Cloud Firestore uses data synchronization to update data on any connected device. However, it's also designed to make simple, one-time fetch queries efficiently. |\n| Offline support | Cloud Firestore caches data that your app is actively using, so the app can write, read, listen to, and query data even if the device is offline. When the device comes back online, Cloud Firestore synchronizes any local changes back to Cloud Firestore. |\n| Designed to scale | Cloud Firestore brings you the best of Google Cloud's powerful infrastructure: automatic multi-region data replication, strong consistency guarantees, atomic batch operations, and real transaction support. We've designed Cloud Firestore to handle the toughest database workloads from the world's biggest apps. |\n\nHow does it work?\n\nCloud Firestore is a cloud-hosted, NoSQL database that your Apple, Android, and web\napps can access directly via native SDKs. Cloud Firestore is also available\nin native Node.js, Java, Python, Unity, C++ and Go SDKs, in addition to REST and\nRPC APIs.\n\nFollowing Cloud Firestore's NoSQL data model, you store data in documents that\ncontain fields mapping to values. These documents are stored in\ncollections, which are containers for your documents that you can use to\norganize your data and build queries. Documents support many different\n[data types](/docs/firestore/manage-data/data-types), from simple strings and numbers, to\ncomplex, nested objects. You can also create subcollections within\ndocuments and build hierarchical data structures that scale as your\ndatabase grows. The Cloud Firestore [data model](/docs/firestore/data-model) supports whatever\ndata structure works best for your app.\n\nAdditionally, querying in Cloud Firestore is expressive, efficient, and flexible.\nCreate shallow queries to retrieve data at the document level without needing to\nretrieve the entire collection, or any nested subcollections. Add sorting,\nfiltering, and limits to your queries or cursors to\npaginate your results. To keep data in your apps current, without retrieving\nyour entire database each time an update happens, add realtime listeners.\nAdding realtime listeners to your app notifies you with a data snapshot whenever\nthe data your client apps are listening to changes, retrieving only the new\nchanges.\n\nProtect access to your data in Cloud Firestore with Firebase Authentication and\nCloud Firestore Security Rules for Android, Apple platforms, and JavaScript, or Identity\nand Access Management (IAM) for server-side languages.\n\nImplementation path\n\n|---|------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------|\n| | Integrate the Cloud Firestore SDKs | Quickly include clients via Gradle, CocoaPods, or a script include. |\n| | Secure your data | Use Cloud Firestore Security Rules or Identity and Access Management (IAM) to secure your data for mobile/web and server development, respectively. |\n| | Add Data | Create documents and collections in your database. |\n| | Get Data | Create queries or use realtime listeners to retrieve data from the database. |\n\nNext steps\n\n- [Get started](/docs/firestore/quickstart) with Cloud Firestore --- set up your database, then add data and start reading it.\n- Learn more about the Cloud Firestore [data model](/docs/firestore/data-model).\n- Explore the [differences between Realtime Database and Cloud Firestore](/docs/firestore/rtdb-vs-firestore)."]]