Non-generic GetView with a view that uses a reduce function
Hi, I'm new to Couchbase and I'm having a little trouble using the non-generic GetView in the 1.2 .NET Library. I'm using the example Beer class shown here http://www.couchbase.com/develop/net/next, and my view function is:
function (doc) { if(doc.type == 'beer') { emit([doc.brewery, doc.name], null); } }
With a _count reduce using group level 1.
And here is the code to get the view and iterate through it.
var view = client.GetView("beers", "by_brewery_and_name").GroupAt(1).Group(true); foreach (var row in view) { // do something }
When I go to run the code it throws an unhandled exception:
Unhandled Exception: System.InvalidOperationException: The value 'id' was not found in the row definition. at Couchbase.CouchbaseView.__Row..ctor(CouchbaseView owner, IDictionary`2 row) in C:\dev\couchbase-net-client-build\src\Couchbase\CouchbaseView.cs:line 49 at Couchbase.CouchbaseView.b__0(JsonReader jr) in C:\dev\couchbase-net-client-build\src\Couchbase\CouchbaseView.cs:line 29 at Couchbase.CouchbaseViewBase`1.d__0`1.MoveNext() in C:\dev\couchbase-net-client-build\src\Couchbase\CouchbaseViewBase.cs:line 104
Am I doing something wrong? Or can you not iterate through an IView that uses a reduce function?
It's a bug in the .NET 1.2 preview. John's working on it. http://www.couchbase.com/issues/browse/NCBC-51
Hi All,
Actually i have an query on ,"How to pass parameter from front end by using GetView",Because wr are not going to do any hard coding in CouchDB so please help me to get the result.
var result = c.GetView("design Name", "View Name").Where("empName ="Amjkj000").AsQueryable();
it doesn't work ,
So if any body has getting this type of knowledge please revert me the code.
Hi,
I am facing exactly the same problem.
Did you find a way to solve it?
Thanks in advance
Regards
Martin