Couchbase .Net Library complex startKey/endKey types

末鹿安然 提交于 2019-12-25 05:14:12

问题


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:


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);



来源:https://stackoverflow.com/questions/11140751/couchbase-net-library-complex-startkey-endkey-types

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!