clklachu
clklachu

Reputation: 971

Couchbase GetView .NET - Query Failed

I was successful in storing my complex C# object (class with some properties) in to the Couchbase using the .NET Sdk. I also created a View and now im trying to get the data (collection of records) from the view. But when I use the GetView method, I always get the error "Query failed for view by_reviewerID in design document _design/Test"

var result = = CouchManager.Instance.GetView("_design/dev_Test", "by_reviewerID");

I have the view both in the Design and the Production. Above is for Design view. When I go to the Couchbase server and use the http link to see the view result, I'm able to get the data as JSON. But when i do it through the code, I always get the above exception. Below is the part of the stack trace.

Couchbase.d__01.MoveNext() +1687
System.Linq.Enumerable.Count(IEnumerable
1 source)

My Map function for the view is

function (doc,meta) {
  emit(doc, null);
}

Could you please kindly help me as i'm struck up in this issue?

Upvotes: 2

Views: 860

Answers (1)

clklachu
clklachu

Reputation: 971

Found out the actual issue. The issue was in passing the right parameters for the GetView method.

var result = = CouchManager.Instance.GetView("dev_Test", "by_reviewerID");

Above is the correct code which works. The issue is that the design document name need not be prefixed with '_design/' . Sharing the code as it might help someone who is facing the same issue.

Note: the prefix 'dev_' is for the Design View. For the Production View, this prefix must be removed.

Upvotes: 3

Related Questions