0

I have a model as follows:

class Page{
   int statuscode;
}

Then I have this view,

function (doc, meta) {
   if(doc.statusCode){
     emit(doc.statusCode, 1);
   }
}

I want to query this index to get the status codes that is not 200 and 300.

I am using c#.

I can query this view with a key(200) this gives me the reduce for it. But i want to find reduce that is not 200 and 300. ie: i want to get 400, 404, 500 etc.

How can I do this?

Jonathan Hall
  • 75,165
  • 16
  • 143
  • 189
DarthVader
  • 52,984
  • 76
  • 209
  • 300
  • possible duplicate of [Querying "Not In" in Couchbase](http://stackoverflow.com/questions/27890297/querying-not-in-in-couchbase) – FuzzyAmi Aug 17 '15 at 17:10

1 Answers1

1

There is no 'not' functionality when querying views. But depending on your situation you may try one of two things:

Key Range If all of the keys you DO want are within an unbroken range, then you can specify a startkey and endkey to capture those statuscodes.

Key List If you know all the keys you DO want and it is a relatively small list, you can specify a list of keys.

Documentation on querying Views: http://docs.couchbase.com/admin/admin/Views/views-querying.html

kruthar
  • 309
  • 1
  • 2
  • 10