NDB.RemoteDB.GetAllDocuments C# (CSharp) Method

GetAllDocuments() public method

Get information on all the documents in the given database.
public GetAllDocuments ( string server, string db ) : NDB.DocInfo[]
server string The server URL
db string The database name
return NDB.DocInfo[]
        public DocInfo[] GetAllDocuments(string server, string db)
        {
            string result = DoRequest(server + "/" + db + "/_all_docs", "GET");

            List<DocInfo> list = new List<DocInfo>();

            JsonData d = JsonMapper.ToObject(result);
            foreach (JsonData row in d["rows"])
            {
                DocInfo doc = new DocInfo();
                doc.ID = row["id"].ToString();
                doc.Revision = (row["value"])["rev"].ToString();
                list.Add(doc);
            }
            return list.ToArray();
        }

Usage Example

Example #1
0
 public void RemoteTest()
 {
     RemoteDB remoteDB = new RemoteDB();
     remoteDB.GetAllDocuments("http://127.0.0.1:5984", "test");
 }