NDB.RemoteDB.ExecTempView C# (CSharp) Method

ExecTempView() public method

Execute a temporary view and return the results.
public ExecTempView ( string server, string db, string map, string reduce, string startkey, string endkey ) : string
server string The server URL
db string The database name
map string The javascript map function
reduce string The javascript reduce function or /// null if not required
startkey string The startkey or null not to use
endkey string The endkey or null not to use
return string
        public string ExecTempView(string server, string db, string map, string reduce, string startkey, string endkey)
        {
            // Generate the JSON view definition from the supplied
            // map and optional reduce functions...
            string viewdef = "{ \"map\":\"" + map + "\"";
            if (reduce != null)
                viewdef += ",\"reduce\":\"" + reduce + "\"";
            viewdef += "}";

            string url = server + "/" + db + "/_temp_view";
            if (startkey != null)
            {
                url += "?startkey=" + System.Web.HttpUtility.UrlEncode(startkey);
            }
            if (endkey != null)
            {
                if (startkey == null) url += "?"; else url += "&";
                url += "endkey=" + HttpUtility.UrlEncode(endkey);
            }
            return DoRequest(url, "POST", viewdef, "application/json");
        }