couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From He Shiming <>
Subject Mapping multiple entries in an array field? (like tags)
Date Sun, 22 May 2011 06:59:37 GMT
Dear Community,

I'm working with documents like this:
    "tags": ["python", "couchdb", "web"]

I'd like to be able to query this document, by all of the following keys:
["python", "web"]
["couchdb", "python"]
["web", "python", "couchdb"]

but not by keys such as:
["python", "redis"]

It's a tag-like situation. I can have the parameter and the field
sorted in alphabetical order if necessary. But it should support any
number of "tags" as the key.

The only solution I figured, is to compose a list of possible key
combinations in the map function, then emit all of them. And this way,
one view will only be able to handle a fixed number of keys. For that
matter, the function gets really complicated for the 3-key (or above)
query. So I'm wondering if there are better ways to do this.

He Shiming

View raw message