Filter data by two or more fields in document

Is there any way to filter data from DB by two or more fields?

For example, I want to find document by TYPE that equal to Message and DATE that between 1.01.2014 and 18.01.2014?

So, the question could I do anything like NSPredicate and CoreData? Make very flexible searching in database?

1 Answer

« Back to question.

Create a view that emits [type, date] pairs as keys. You can then use a key range like startkey=["Message", "2014-01-01"], endkey=["Message", "2014-01-18"].

Great! It helps a lot. But, I didn't get is there any way to do the same for 3, 4 etc fields at once? Only 2 per view, am I right?

Arrays can have more than two elements.

You might also want to read http://guide.couchdb.org/draft/views.html