combine multiple documents in a couchdb view

前端 未结 1 1212
北荒
北荒 2021-01-06 07:02

In couchdb, I need to represent some data in the following format, a outer container that references other documents inside an array.

I want to keep these documents

相关标签:
1条回答
  • 2021-01-06 07:50

    You can achieve this using couchdb linked documents

    here is how the view will look like

      function(doc){
        if(doc.items)
        doc.items.forEach(function(item){
              emit(doc._id,{_id:item});
          })
     }
    

    now you can query the view with include_docs=true parameter and you should have the desired result.

    0 讨论(0)
提交回复
热议问题