我想使用来自couchbase控制台的纯SQL查询来查询couchbase数据。
oop架构将是这样的。
原件:
class travel-sample{
//all properties
List<Schedule> schedule;
}
class Schedule{
//all properties
}
需要在单独的课程中预测这样的旅行样本:
class travel-sample-another{
//some properties
List<Schedule> schedule;
}
class Schedule-another{
//some properties
}
以下是文件:
文件:
[
{
"travel-sample": {
"airline": "AF",
"airlineid": "airline_137",
"destinationairport": "MRS",
"distance": 2881.617376098415,
"equipment": "320",
"id": 10000,
"schedule": [
{
"day": 4,
"flight": "AF818",
"utc": "08:02:00"
},
{
"day": 5,
"flight": "AF967",
"utc": "11:33:00"
},
{
"day": 5,
"flight": "AF730",
"utc": "19:42:00"
}
],
"sourceairport": "TLV",
"stops": 0,
"type": "route"
}
}
]
如何查询以获得这样的结果:
[
{
"travel-sample": {
"airline": "AF",
"airlineid": "airline_137",
"destinationairport": "MRS",
"schedule": [
{
"flight": "AF818",
"utc": "08:02:00"
},
{
"flight": "AF967",
"utc": "11:33:00"
},
{
"flight": "AF730",
"utc": "19:42:00"
}
],
"sourceairport": "TLV",
"type": "route"
}
}
]
我们可以看到day
属性不在地图数组中用于计划等等。我希望有效地使用这种格式。我是沙发基地的新手。也许UNNEST,NEST或Iteration可以提供帮助,但是,我无法找到准确检索此结果的方法。只是简单的SQL查询对我有好处。我会照顾其他的东西。先感谢您。