Json 从Postman创建Firestore数据库文档
我正在尝试在Firestore集合中同时创建多个文档,以便进行配置。我可以从邮递员处逐个创建文档:Json 从Postman创建Firestore数据库文档,json,rest,api,google-cloud-firestore,postman,Json,Rest,Api,Google Cloud Firestore,Postman,我正在尝试在Firestore集合中同时创建多个文档,以便进行配置。我可以从邮递员处逐个创建文档: { "fields": { "category":{"stringValue": "Configs"}, "order":{"integerValue":"3"} } } 我想知道是否有办法创建多个文档,并发送如下内容: { "batch": [ { "fields": {
{
"fields": {
"category":{"stringValue": "Configs"},
"order":{"integerValue":"3"}
}
}
我想知道是否有办法创建多个文档,并发送如下内容:
{
"batch": [
{
"fields": {
"categoria": {
"stringValue": "Configurações"
},
"ordem": {
"integerValue": "3"
}
}
},
{
"fields": {
"categoria": {
"stringValue": "Configurações"
},
"ordem": {
"integerValue": "3"
}
}
}
]
}
有人能说这是否可能吗?如果是这样的话,我该怎么做呢?下面类似的方法应该可以奏效 虽然这是一个“更新”操作,但如果文档不存在,它也会创建新文档。必须提供文档ID,不能使用提交端点自动生成 在查看了这个详细的用例使用之后,我能够让我的用例正常工作 API端点:
像下面这样的东西应该可以用 虽然这是一个“更新”操作,但如果文档不存在,它也会创建新文档。必须提供文档ID,不能使用提交端点自动生成 在查看了这个详细的用例使用之后,我能够让我的用例正常工作 API端点:
你做对了吗?你做对了吗?
{
"writes": [
{
"update": {
"name": "projects/projectID/databases/(default)/documents/test/ExistingDocumentID1",
"fields": {
"comment": {
"stringValue": "Hello World!"
}
}
}
},
{
"update": {
"name": "projects/projectID/databases/(default)/documents/test/NewManualDocumentID2",
"fields": {
"comment": {
"stringValue": "Happy Birthday!"
}
}
}
}
]
}