couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matthew Woodward <>
Subject Writing View to Get Unique Values in Arrays Across Documents
Date Wed, 19 Jan 2011 23:22:49 GMT
Been banging my head on this one only briefly but figured I'd ask before
banging further.

I have documents with a property that's an array. I want to write a view to
retrieve all documents based on an ID in the document (not the document ID,
but another ID that will exist in multiple documents), and the ultimate end
result I want is the distinct/unique values from the array data across these

To give a concrete example, let's say I have the following two documents:

idToRetrieveBy: 1
arrayData: ['Homer','Marge','Bart']

idToRetrieveBy: 1
arrayData: ['Homer','Marge','Bart','Lisa','Maggie']

>From the view, what I'd want to get back is:

Any ideas on how to go about that, or is that something I'd have to crunch
on the application side of things?


Matthew Woodward / Twitter: @mpwoodward

Please do not send me proprietary file formats such as Word, PowerPoint,
etc. as attachments.

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message