发送反馈
Method: projects.databases.documents.batchGet
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
获取多个文档。
不保证此方法返回的文档按照请求的顺序返回。
HTTP请求 POST https://firestore.googleapis.com/v1beta1/{database=projects/*/databases/*}/documents:batchGet
URL 使用gRPC 转码 语法。
路径参数 参数 database
string
必需的。数据库名称。格式为: projects/{projectId}/databases/{databaseId}
。
请求正文 请求正文包含具有以下结构的数据:
JSON 表示 {
"documents" : [
string
] ,
"mask" : {
object (DocumentMask
)
} ,
// Union field consistency_selector
can be only one of the following:
"transaction" : string ,
"newTransaction" : {
object (TransactionOptions
)
} ,
"readTime" : string
// End of list of possible types for union field consistency_selector
.
}
领域 documents[]
string
要检索的文档的名称。格式为: projects/{projectId}/databases/{databaseId}/documents/{document_path}
。如果任何文档不是给定database
的子资源,则请求将失败。重复的名称将被删除。
mask
object ( DocumentMask
)
要返回的字段。如果未设置,则返回所有字段。
如果文档具有此掩码中不存在的字段,则该字段将不会在响应中返回。
联合字段consistency_selector
。此事务的一致性模式。如果不设置,默认为强一致性。 consistency_selector
只能是以下之一: transaction
string ( bytes format)
读取事务中的文档。
Base64 编码的字符串。
newTransaction
object ( TransactionOptions
)
启动新事务并读取文档。默认为只读事务。新的事务 ID 将作为流中的第一个响应返回。
readTime
string ( Timestamp
format)
按给定时间的原样读取文档。
这必须是过去一小时内的微秒精度时间戳,或者如果启用了时间点恢复,则还可以是过去 7 天内的整分钟时间戳。
RFC3339 UTC“Zulu”格式的时间戳,具有纳秒分辨率和最多九个小数位。示例: "2014-10-02T15:01:23Z"
和"2014-10-02T15:01:23.045123456Z"
。
响应体 Firestore.BatchGetDocuments
的流式响应。
如果成功,响应正文包含具有以下结构的数据:
JSON 表示 {
"transaction" : string ,
"readTime" : string ,
// Union field result
can be only one of the following:
"found" : {
object (Document
)
} ,
"missing" : string
// End of list of possible types for union field result
.
}
领域 transaction
string ( bytes format)
作为此请求的一部分启动的事务。仅在第一个响应中设置,并且仅当在请求中设置了BatchGetDocumentsRequest.new_transaction
时才设置。
Base64 编码的字符串。
readTime
string ( Timestamp
format)
阅读文档的时间。这可能是单调递增的,在这种情况下,保证结果流中的前一个文档在其 readTime 和本文档之间不会发生更改。
RFC3339 UTC“Zulu”格式的时间戳,具有纳秒分辨率和最多九个小数位。示例: "2014-10-02T15:01:23Z"
和"2014-10-02T15:01:23.045123456Z"
。
联盟场result
。单一结果。如果服务器只是返回事务,则该值可以为空。 result
只能是以下之一: found
object ( Document
)
所要求的文件。
missing
string
已请求但不存在的文档名称。格式为: projects/{projectId}/databases/{databaseId}/documents/{document_path}
。
授权范围 需要以下 OAuth 范围之一:
https://www.googleapis.com/auth/datastore
https://www.googleapis.com/auth/cloud-platform
有关详细信息,请参阅身份验证概述 。
发送反馈
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可 获得了许可,并且代码示例已根据 Apache 2.0 许可 获得了许可。有关详情,请参阅 Google 开发者网站政策 。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2023-12-01。
[{
"type": "thumb-down",
"id": "missingTheInformationINeed",
"label":"没有我需要的信息"
},{
"type": "thumb-down",
"id": "tooComplicatedTooManySteps",
"label":"太复杂/步骤太多"
},{
"type": "thumb-down",
"id": "outOfDate",
"label":"内容需要更新"
},{
"type": "thumb-down",
"id": "translationIssue",
"label":"翻译问题"
},{
"type": "thumb-down",
"id": "samplesCodeIssue",
"label":"示例/代码问题"
},{
"type": "thumb-down",
"id": "otherDown",
"label":"其他"
}]
[{
"type": "thumb-up",
"id": "easyToUnderstand",
"label":"易于理解"
},{
"type": "thumb-up",
"id": "solvedMyProblem",
"label":"解决了我的问题"
},{
"type": "thumb-up",
"id": "otherUp",
"label":"其他"
}]
需要向我们提供更多信息?