Suppose I have couchdb docs that look like so:
{
"_id": "id",
"_rev": "rev",
"title": "foobar",
"URI": "http://www.foobar.com",
"notes": "",
"date": 1334177254774,
"tags": [
"tag1",
"tag2",
"tag3"
],
"date_modified": 1334177278457,
"deleted": false
}
What I want is to create an inverted index from the tags, so I end up with something like:
{
"tag1": [
_id,
_id,
_id
],
"tag2": [
_id,
_id,
...
]
}
From what I've read and tried, couchdb might not let me do it. I can't get it done in the map phase, and it doesn't seem like I can do it in the couch reduce phase. Is this something I need to accomplish in another layer of the app?