我有 2 个文档,如何编写一个 return 输出为单个文档的查询
I have 2 documents, how can I write a query which return output as single document
文档 1
{
"accountId": "Test",
"documentType": "config1",
"name": "TestName",
"url": "http://foo"
"date": "2015-08-26T20:27:10.7204029Z"
}
文件 2
{
"accountId": "Test",
"documentType": "config2",
"area": "testArea",
}
单个文档的预期输出:
{
"accountId": "Test",
"documentType": "config",
"name": "TestName",
"area": "testArea"
}
简而言之,你不能。
它们是两个文件。您不能将两个独立的单元连接在一起。
您可以拥有一个包含嵌入式实体的文档,然后它是一个包含两个子文档的文档,您可能会这样做。
所以可能有 {"accountId" : "Test", "config" : [ {"id": "config1", "" }, {"id" : "config2" } ] }
文档 1 { "accountId": "Test", "documentType": "config1", "name": "TestName", "url": "http://foo" "date": "2015-08-26T20:27:10.7204029Z" }
文件 2 { "accountId": "Test", "documentType": "config2", "area": "testArea", }
单个文档的预期输出: { "accountId": "Test", "documentType": "config", "name": "TestName", "area": "testArea" }
简而言之,你不能。 它们是两个文件。您不能将两个独立的单元连接在一起。
您可以拥有一个包含嵌入式实体的文档,然后它是一个包含两个子文档的文档,您可能会这样做。
所以可能有 {"accountId" : "Test", "config" : [ {"id": "config1", "" }, {"id" : "config2" } ] }