2017-01-09 18 views
2

我目前正在嘗試從Cloudant DB中批量讀取文檔。到目前爲止,我已經使用JavaScript完成了批量閱讀。但是,我正在嘗試在C#中完成,這是不同的。C#中的Cloudant DB查詢批量讀取

這是我在JavaScript中完成的,可以在C#中完成嗎?

db.allDocs({ 
    include_docs: true, 
    attachments: true, 
    startkey: 'receipt', 
    endkey: 'receipt\uffff' 
}).then(function (result) { 

}); 

回答

0

您有幾種選擇,其中主要可能是:

  1. 使用第三方C#庫像MyCouch
  2. 使用C#的WebClient,使對Cloudant API
  3. 使用電話C#通用休息庫如RestSharp撥打電話Cloudant API

這裏是MyCouch一個片段:


系統的觀點

如果你想消費的內置CouchDB的系統視圖中,使用QueryViewRequest構造一個說法。這裏的消費觀點all_docs的樣本:

var query = new QueryViewRequest("_all_docs"); 
var response = await client.Views.QueryAsync<dynamic>(query); 

來源:https://github.com/danielwertheim/mycouch/wiki/documentation#system-views