Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有 2 个文件:
{ 路径:“/monster/green”,名称:“绿色怪物”,年龄:105,时间线:1 }
{ 路径:“/monster/green” 名称:“真正的绿色怪物”,时间线:2 }
问题:
如何创建 CouchDB 视图,其中文档按“时间线”排序,结果是它们的组合:
{ 路径:“/monster/green”,名称:“真正的绿色怪物”,年龄:105 }
您可以轻松创建一个视图,该视图将为您提供以下输出key="/monster/green":
key="/monster/green"
{[ {"key":"/monster/green", "value":{"name": "Green monster", "age": 105}, {"key":"/monster/green", "value":{"name": "Really Green monster"} ]}
除了格式,这与您想要的数据非常相似。如果你真的需要改变格式,你可以list在你的view.
list
view