Reputation: 143
I need filter this view:
function (doc) {
if (doc.doc_type == 'asd'){
emit([doc.date, doc.string_key_0, doc.string_key_1], doc.list_field);
};
}
I do:
key_filter_0 = ['START_TIME', 'STRING0', 'STRING1']
key_filter_1 = ['END_TIME', 'STRING0', 'STRING1']
VIEW[key_filter_0:key_filter_1]
but the view only filtered with START_TIME
and END_TIME
. It just ignored the STRING0
/ STRING1
key filters.
Upvotes: 2
Views: 352
Reputation: 4631
There's no such thing as 'key filters' in CouchDB.
Every item you emit into your view will be sorted by its key, and you can then find all items between a given startkey and endkey. In your case, items are first sorted by date then string_key_0 then string_key_1.
It sounds like you were expecting to only see items between 'START_TIME' and 'END_TIME' where all items had 'STRING0' for the second item and 'STRING1' for the third item, but this is not how CouchDB views work. They are a one-dimensional list of items, sorted by the whole key.
Upvotes: 1