现已推出具有 MongoDB 兼容性的 Firestore 企业版!
了解详情。
配额和限制
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
仅与 Cloud Firestore 企业版相关。
|
本页面介绍了具有 MongoDB 兼容性的 Cloud Firestore 的请求配额和限制。
免费层级使用量
具有 MongoDB 兼容性的 Cloud Firestore 提供免费层级,让您可以免费开始使用具有 MongoDB 兼容性的 Cloud Firestore。下表列出了免费层级的用量。
免费层级用量按日计算,并在美国太平洋时间零点重置。
免费层级仅适用于每个项目中的一个与 MongoDB 兼容的 Cloud Firestore 数据库。
在没有免费层级数据库的项目中创建的第一个数据库将获得免费层级。如果删除了应用了免费层级的数据库,则下一个创建的数据库将获得免费层级。
免费层级 |
配额 |
数据存储 |
1 GiB |
读取单位 |
每天 50000 次 |
写入单位 |
每天 40,000 次 |
出站数据传输 |
每月 10 GiB |
以下操作和功能不包含免费使用量。您必须启用结算功能才能使用以下功能:
如需详细了解这些功能的结算方式,请参阅存储价格。
标准限制
下表显示了适用于与 MongoDB 兼容的 Cloud Firestore 的限额。除非另有说明,否则这些属于硬性限额。
数据库
集合、文档和字段
限制 |
详细信息 |
对于集合名称的限制 |
- 必须是有效的 UTF-8 字符
- 长度不能超过 1500 字节
- 无法匹配正则表达式
__.*__
- 不得包含
$
- 不得为空字符串 (
"" )
- 不得包含 null 字符
- 不能以 `system.` 开头,也不能包含 `.system.`。
|
对于文档 ID 的限制 (_id ) |
- 文档
_id (顶级字段)必须是 ObjectId、String、64 位整数、32 位整数、Double 或 Binary。不支持其他 BSON 类型。
- 长度不能超过 1500 字节
对于字符串 ID:
- 必须是有效的 UTF-8 字符
- 不得为空字符串 (
"" )
- 无法匹配正则表达式
__.*__
- 对于 64 位整数 ID,不支持 64 位 0 (0L)。
|
文档的大小上限 |
4 MiB |
对于字段名称的限制 |
- 必须是有效的 UTF-8 字符
- 不得为空字符串 (
"" )
- 无法匹配正则表达式
__.*__
|
字段名称的大小上限 |
1500 字节 |
字段路径的大小上限 |
1500 字节 |
字段值的大小上限 |
4 MiB - 89 字节 |
映射 (map) 或数组中字段的最大深度 |
20
映射和数组字段会向对象的总深度额外添加一层深度。例如,以下对象的总深度为三层:
{
nested_object: { #depth 1
nested_array: [ #depth 2
{
foo: "bar" #depth 3
}
]
}
}
|
读取、写入和事务
限制 |
详细信息 |
查询的内存限制 |
128 MiB |
事务的时间限制 |
270 秒,以及 60 秒的闲置状态过期时间 |
索引
限制 |
详细信息 |
一个数据库的索引数量上限 |
1000
您可以与支持团队联系,申请提高此限制。
|
每个文档的索引条目数量上限
|
40000
|
索引中的字段数上限 |
100 |
索引条目的大小上限 |
7.5 KiB
|
一个文档的索引条目的大小总和上限 |
8 MiB
|
存留时间 (TTL)
限制 |
详细信息 |
一个数据库的 TTL 配置数量上限 |
500
|
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-08-29。
[null,null,["最后更新时间 (UTC):2025-08-29。"],[],[],null,["\u003cbr /\u003e\n\n\n|--------------------------------------------------------|\n| *Relevant to Cloud Firestore Enterprise edition only.* |\n\n\u003cbr /\u003e\n\nThis page describes the request quotas and limits for Cloud Firestore with MongoDB compatibility.\n\nFree tier usage\n\nCloud Firestore with MongoDB compatibility offers a free tier that lets you get started with\nCloud Firestore with MongoDB compatibility at no cost. The free tier amounts are listed in the following\ntable.\n\nFree tier amounts are applied daily and reset at midnight Pacific time.\n\nThe free tier applies to only one Cloud Firestore with MongoDB compatibility database per project.\nThe first database that is created in a project without a free tier database\nwill get the free tier. If the database with the free tier applied is deleted,\nthe next database created will receive the free tier.\n\n\u003cbr /\u003e\n\n| Free tier | Quota |\n|------------------------|------------------|\n| Stored data | 1 GiB |\n| Read units | 50,000 per day |\n| Write units | 40,000 per day |\n| Outbound data transfer | 10 GiB per month |\n\n\u003cbr /\u003e\n\nThe following operations and features don't include free usage.\nYou must [enable billing](https://cloud.google.com/billing/docs/how-to/modify-project) to use these features:\n\n- Managed deletes (TTL)\n- Backup data\n- Restore operations\n\nFor more information about how these features are billed, see\n[Storage pricing](https://cloud.google.com/firestore/enterprise/pricing#storage-size#storage-size).\n\nStandard limits\n\nThe following tables show the limits that apply to\nCloud Firestore with MongoDB compatibility. These are hard limits unless otherwise noted.\n\nDatabases\n\n| Limit | Details |\n|--------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Maximum number of databases per project | 100 [Contact support](https://cloud.google.com/support-hub) to request an increase to this limit. |\n| Maximum number of [customer-managed encryption keys (CMEK) databases](/docs/firestore/enterprise/cmek) per project | 0 By default the quota is 0 because this feature is behind an allowlist. You can request to increase the quota by filling in [the CMEK access request form](https://docs.google.com/forms/d/e/1FAIpQLSfKs8wJf4IXu1NizvfyU2vT59JDbdPvkehMVZ2ab5l_aDLIIA/viewform?resourcekey=0-O15dlRFvA0JIDmh6VFUEcA). |\n\nCollections, documents, and fields\n\n| Limit | Details |\n|-------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Constraints on collection names | - Must be valid UTF-8 characters - Must be no longer than 1,500 bytes - Can't match the regular expression `__.*__` - Can't contain `$` - Can't be the empty string (`\"\"`) - Can't contain the null character - Can't begin with \\`system.\\` and can't contain \\`.system.\\`. |\n| Constraints on document IDs (`_id`) | - Document `_id` (top-level field) must be an ObjectId, String, 64-bit integer, 32-bit integer, Double, or Binary. Other BSON types are not supported. - Must be no longer than 1,500 bytes - For String IDs: - Must be valid UTF-8 characters - Can't be the empty string (`\"\"`) - Can't match the regular expression `__.*__` - For 64-bit integer IDs, 64-bit 0 (0L) is not supported. |\n| Maximum size for a document | 4 MiB |\n| Constraints on field names | - Must be valid UTF-8 characters - Can't be the empty string (`\"\"`) - Can't match the regular expression `__.*__` |\n| Maximum size of a field name | 1,500 bytes |\n| Maximum size of a field path | 1,500 bytes |\n| Maximum size of a field value | 4 MiB - 89 bytes |\n| Maximum depth of fields in a map or array | 20 Map and array fields add one level to the overall depth of an object. For example, the following object has a total depth of three levels: ``` { nested_object: { #depth 1 nested_array: [ #depth 2 { foo: \"bar\" #depth 3 } ] } } ``` |\n\nReads, writes, and transactions\n\n| Limit | Details |\n|------------------------------|----------------------------------------------------|\n| Memory limit for a query | 128 MiB |\n| Time limit for a transaction | 270 seconds, with a 60-second idle expiration time |\n\nIndexes\n\n| Limit | Details |\n|--------------------------------------------------------|----------------------------------------------------------------------------------------------------|\n| Maximum number of indexes for a database | 1000 [Contact support](https://cloud.google.com/support-hub) to request an increase to this limit. |\n| Maximum number of index entries for each document | 40,000 |\n| Maximum number of fields in an index | 100 |\n| Maximum size of an index entry | 7.5 KiB |\n| Maximum sum of the sizes of a document's index entries | 8 MiB |\n\nTime to live (TTL)\n\n| Limit | Details |\n|-----------------------------------------------------|---------|\n| Maximum number of TTL configurations for a database | 500 |"]]