Filter data, .net client


#1

Hi,
I have a document with 3 million records, I created view and I want to filter data by some fields (e.g. between date or some other conditions), how I can do this?
If I use GetView(“view”, “view”).Where(o => …) it’s returns all data from view and it’s terrible for perfomance.
Regards, Alex


#2

Hi, you can use view query param to limit your search:
Look here how you can do it with the .net sdk: http://www.couchbase.com/docs/couchbase-sdk-net-1.2/api-reference-view.html
and here is the general view reference: http://www.couchbase.com/docs/couchbase-manual-2.0/couchbase-views.html
Thanks,
Michael


#3

but I can’t find the way to filter by AND condition. Like in SQL key1=‘T’ and key2=‘T2’?
Oh, I understood how to do.
Regards, Alex


#4

You cannot use 2 keys to filter in a view. The map function generates only 1 single key on which you can apply filter.
Based on your data model and views you may use Compound keys/criterion as documented here
http://www.couchbase.com/docs/couchbase-manual-2.0/couchbase-views-writi
Let me know if this is ok with your use case
Regards
Tug


#5

Yeh, I know.
I meant 1 compound key and yes - it’s that I need.
Regards, Alex