CouchDB emit with lookup key that is array, such that order of array elements are ignored.
Posted
by
MatternPatching
on Stack Overflow
See other posts from Stack Overflow
or by MatternPatching
Published on 2011-01-08T22:51:34Z
Indexed on
2011/01/08
22:53 UTC
Read the original article
Hit count: 155
couchdb
When indexing a couchdb view, you can emit an array as the key such as: emit(["one", "two", "three"], doc); I appreciate the fact that when searching the view, the order is important, but sometimes I would like the view to ignore it. I have thought of a couple of options. 1. By convention, just emit the contents in alphabetical order, and ensure that looking up uses the same convention. 2. Somehow hash in a manner that disregards the order, and emit/search based on that hash. (This is fairly easy, if you simply hash each one individually, "sum" the hashes, then mod.) Note: I'm sure this may be covered somewhere in the authoritative guide, but I was unsuccessful in finding it.
© Stack Overflow or respective owner