View Query in .NET SDK

Hi,

I’m having a problem querying against a View using .NET sdk 2.0.3. I hadn’t any problem to insert data, but I couldn’t retrieve it.

I tryed make the query in the web console and It’s work, but in the code didn’t return anything.

The code is the following:

var query = bucket.CreateQuery("queries", "ById", false); var result = bucket.Query<dynamic>(query);

Any idea?

@spachecojimenez

What does your map function look like? What about your data?

-Jeff

The map function is the next:

function (doc, meta) {
  if(meta.id === "2_RSA"){
emit([meta.id], null);
  }
}

And the data is like this:

{
    'data': [[1, 2, 3, 4 ], [6, 7, 8]]
}

@spachecojimenez -

Have you published your view?

Once I published the view, I get:

-Jeff

Hi,

Yes, I published the view and I have this code:

foreach (var row in result.Rows)
            {
                lines.Add(row.Value.Data.ToString());
            }

            File.WriteAllLines(@"C:\Users\sergio pacheco\Desktop\demo\demo.txt", lines);

Problem fixed.

It was something wrong with the dependencies of the project.

Thanks for the help.

1 Like