couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alex Brandt <alund...@alunduil.com>
Subject Categorization Views
Date Sat, 16 Jan 2016 04:49:14 GMT
Hey,

I've been poking at how to construct views using the map reduce mechanics but 
am struggling with crafting a particular view.  I have a set of data where 
documents have a category and I'd like to have a view that provides me with 
groups of documents based on their category.  Is it possible to get the 
following three documents into the subsequent view (loosely defined)?

* { "category": "A", "_id": "1" }
* { "category": "A", "_id": "2" }
* { "category": "B", "_id": "3" }

View:

{ "A": [ { "category": "A", "_id": "1" }, { "category": "A", "_id": "2" } ], 
"B": [ { "category": "B", "_id": "3" } ] }

Any pointers would be appreciated.

Thanks,

-- 
Alex Brandt
Software Developer for Rackspace and Developer for Gentoo
http://blog.alunduil.com

Mime
View raw message