C# Class NDB.RemoteDB

A simple wrapper class for the CouchDB HTTP API. No initialisation is necessary, just create an instance and call the appropriate methods to interact with CouchDB. All methods throw exceptions when things go wrong.
显示文件 Open project: Kirosoft/NouchDB Class Usage Examples

Public Methods

Method Description
BatchGetDocs ( string server, string db, string content ) : string

Create a new document. If the document has no ID field, it will be assigned one by the server.

CountDocuments ( string server, string db ) : int

Get the document count for the given database.

CreateDatabase ( string server, string db ) : void

Create a new database.

CreateDocument ( string server, string db, string content ) : void

Create a new document. If the document has no ID field, it will be assigned one by the server.

DeleteDatabase ( string server, string db ) : void

Delete a database

DeleteDocument ( string server, string db, string docid ) : void

Delete a document.

ExecTempView ( string server, string db, string map, string reduce, string startkey, string endkey ) : string

Execute a temporary view and return the results.

GetAllDocuments ( string server, string db ) : NDB.DocInfo[]

Get information on all the documents in the given database.

GetChanges ( string server, string db, bool includeDocs = false, long since ) : JsonData

Get all changes from the database since a given change revision

GetDatabases ( string server ) : string[]

Get a list of database on the server.

GetDocument ( string server, string db, string docid ) : string

Get a document.

GetDocument ( string server, string db, string docid, string startkey, string endkey ) : string

Get a document.

RemoteDB ( ) : System

Private Methods

Method Description
DoRequest ( string url, string method ) : string

Internal helper to make an HTTP request and return the response. Throws an exception in the event of any kind of failure. Overloaded - use the other version if you need to post data with the request.

DoRequest ( string url, string method, string postdata, string contenttype ) : string

Internal helper to make an HTTP request and return the response. Throws an exception in the event of any kind of failure. Overloaded - use the other version if no post data is required.

Method Details

BatchGetDocs() public method

Create a new document. If the document has no ID field, it will be assigned one by the server.
public BatchGetDocs ( string server, string db, string content ) : string
server string The server URL
db string The database name
content string The document contents (JSON).
return string

CountDocuments() public method

Get the document count for the given database.
public CountDocuments ( string server, string db ) : int
server string The server URL
db string The database name
return int

CreateDatabase() public method

Create a new database.
public CreateDatabase ( string server, string db ) : void
server string The server URL
db string The database name
return void

CreateDocument() public method

Create a new document. If the document has no ID field, it will be assigned one by the server.
public CreateDocument ( string server, string db, string content ) : void
server string The server URL
db string The database name
content string The document contents (JSON).
return void

DeleteDatabase() public method

Delete a database
public DeleteDatabase ( string server, string db ) : void
server string The server URL
db string The name of the database to delete
return void

DeleteDocument() public method

Delete a document.
public DeleteDocument ( string server, string db, string docid ) : void
server string The server URL
db string The database name
docid string The document ID.
return void

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

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[]

GetChanges() public method

Get all changes from the database since a given change revision
public GetChanges ( string server, string db, bool includeDocs = false, long since ) : JsonData
server string The server URL
db string The database name
includeDocs bool
since long sequence number for the last checkpoint, defaults to 0 i.e. all changes
return LitJson.JsonData

GetDatabases() public method

Get a list of database on the server.
public GetDatabases ( string server ) : string[]
server string The server URL
return string[]

GetDocument() public method

Get a document.
public GetDocument ( string server, string db, string docid ) : string
server string The server URL
db string The database name
docid string The document ID.
return string

GetDocument() public method

Get a document.
public GetDocument ( string server, string db, string docid, string startkey, string endkey ) : string
server string The server URL
db string The database name
docid string The document ID.
startkey string The startkey or null not to use
endkey string The endkey or null not to use
return string

RemoteDB() public method

public RemoteDB ( ) : System
return System