作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
假设:
专辑文件:
{
"albumName": "my album",
"photos": [photo1Id, photo2Id, photo3Id]
}
照片文档:
{
"photoName": "photoName1.img";
"photoId": "photo1Id";
"otherData": "Some other data"
}
其中Photo Document的key与photoId相同。
我想做一个将有这个输出的 SELECT 语句:
{
"albumName": "my album",
"photos": [{
"photoName": "photoName1.img";
"photoId": "photo1Id";
"otherData": "Some other data"
},{
"photoName": "photoName2.img";
"photoId": "photo2Id";
"otherData": "Some other data"
},{
"photoName": "photoName3.img";
"photoId": "photo3Id";
"otherData": "Some other data"
}]
}
这可能吗,还是我必须创建多个选择?
最佳答案
使用 NEST clause在结果文档中输出照片数组。
示例:(我使用 type 来过滤您的文档类型,但它可能不是您的情况)
SELECT * FROM bucket albums
NEST bucket photos ON KEYS albums.photos
WHERE albums.type='Album'
关于沙发底座 N1QL : How to aggregate and join from the same bucket with an array of keys,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43900446/
您对在 Heroku 上使用 Iriscouch 或 Cloudant 有任何经验/想法吗? 您是否必须使用 Cloudant(因为它是作为附加组件提供的)? 有什么优点/缺点? 我正在开发一个包含大
我是一名优秀的程序员,十分优秀!