2

Assume I have the following documents:

{
   _id: 'id1',
   tags: ['a', 'b']
}

{
   _id: 'id2',
   tags: ['b', 'c', 'd']
}

{
   _id: 'id3',
   tags: ['c', 'd', 'e']
}

Now I want to get all documents, where ALL tags are a subset of a given set. For example the view keys ['a','b','c','d'] should return doc 'id1' and 'id2' but not document with 'id3', because it contains the tag 'e' which is not in the requested keys.

How would you write such a view in CouchDB?

pangratz
  • 15,875
  • 7
  • 50
  • 75
  • 1
    Is this similar to http://stackoverflow.com/q/5227587/453605 ? – Marcello Nuccio Nov 04 '11 at 13:04
  • 1
    This http://stackoverflow.com/questions/5752002/find-all-possible-subset-combos-in-an-array/5752056#5752056 answer helped me to create the subset of the possible keys. – pangratz Nov 07 '11 at 16:46

0 Answers0