Couchbase .Net Library complex startKey/endKey typ

2019-09-18 10:56发布

I need to convert those params from REST-API query to C# LINQ.

?descending=true&endkey=[35,37]&startkey=[35,37,{}]

In LINQ this query look like this:

c.GetView("MyView", "SubView").StartKey(startKey).EndKey(endKey).Descending(true);

What type should be variables startKey and endKey?

I've tried string, but in this case .Net library produces query with invalid params:

?descending=true&endkey="[35,37]"&startkey="[35,37,{}]"

1条回答
Summer. ? 凉城
2楼-- · 2019-09-18 11:14

I've done some research and found the answer. Acording to https://github.com/couchbase/couchbase-net-client/blob/master/src/Couchbase/CouchbaseViewBase.cs#L320

I've finally find types for my LINQ variables:

object[] startKey = new object[] { 35, 37, "{}" };

object[] endKey = new object[] { 35, 37};

and query: >

c.GetView("MyView", "SubView").StartKey(startKey).EndKey(endKey).Descending(true);

查看更多
登录 后发表回答