Ronin Ronin - 1 year ago 157
C# Question

run a primitive mycouch query

I'm new to couchdb and mycouch. I'm trying to implement a very simple query, I just want to get the results of a view and save it into my DTO class.

My couchdb query works, when I query it manually via HTTP:


However, when I try running it from my app using mycouch, I can't get to run it. My current query:

using MyCouch.Requests;
using MyCouch.Responses;

// (...)

using (var client = new Client("http://localhost:5984/samples")) {
var query = new QueryViewRequest("getAllTshirts");

ViewQueryResponse<TShirt[]> result = await client.Views.QueryAsync<TShirt[]>(query);
Console.WriteLine (result);

For some reason, it won't find the
class. I found an example where
is used on github, as you can see, I'm using all the
related namespaces as in the example.

I also tried using

using (var store = new MyCouchStore("http://localhost:5984/", "samples")) {
var query = new QueryViewRequest("getAllTshirts");
ViewQueryResponse<TShirt[]> result = await store.Views.QueryAsync<TShirt[]>(query);
Console.WriteLine (result);

However, the
doesn't contain any property named
Any ideas how to query my view using MyCouch?

Answer Source

Apparantely, the documentation was not up to date. The constructor requires now 2 arguments, the second being an optional bootstrapper. This worked for me:

var client = new Client("http://localhost:5984/samples", null)
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download