Skip to navigation
How to use tornado couchdb
09.07.16
BlockingCouch and AsyncCouch methods General methods. use(self, db_name='', couch_url='http://127.0.0.1:5984/'): Set database name `db_name` and `couch_url`. close(self): Closes the CouchDB client, freeing any resources used. Database related methods. create_db(self, db_name=None): Creates a new database. delete_db(self, db_name=None): Deletes the database. list_dbs(self): List names of databases. info_db(self, db_name=None): Get info about the database. pull_db(self, source, db_name=None, create_target=False): Replicate changes from a source database to current (target) database. uuids(self, count=1): Get one or more uuids. Document related methods. get_doc(self, doc_id): Get document with the given `doc_id`. get_docs(self, doc_ids): Get multiple documents with the given list of `doc_ids`. Response is a list with the requested documents, in same order as the provided document id's. If one or more documents are not found in the database, a NotFound exception is raised. has_doc(self, doc_id): Check if document with the given `doc_id` exists. Returns True if document exists, returns False otherwise. save_doc(self, doc): Save/create a document to/in a given database. Response is a dict with id and rev of the saved doc. save_docs(self, docs, all_or_nothing=False): Save/create multiple documents. Response is a list of dicts with id and rev of the saved docs. delete_doc(self, doc): Delete a document The `doc` shall be a dict, at least having the keys `_id` and `_rev`. delete_docs(self, docs, all_or_nothing=False): Delete multiple documents The `docs` shall be an array of dicts, each at least having the keys `_id` and `_rev`. get_attachment(self, doc, attachment_name, mimetype=None): Get document attachment. The parameter `doc` should at least contain an `_id` key. If mimetype is not specified, `doc` shall contain an `_attachments` key with info about the named attachment. save_attachment(self, doc, attachment): Save an attachment to the specified doc. The attachment shall be a dict with keys: `mimetype`, `name`, `data`. The `doc` shall be a dict, at least having the key `_id`, and if doc is existing in the database, it shall also contain the key `_rev` delete_attachment(self, doc, attachment_name): Delete a named attachment to the specified doc. The doc shall be a dict, at least with the keys: _id and _rev view(self, design_doc_name, view_name, **kwargs): Query a pre-defined view in the specified design doc. The following query parameters can be specified as keyword arguments. Limit query results to those with the specified key or list of keys: key=
keys=
Limit query results to those following the specified startkey: startkey=
First document id to include in the output: startkey_docid=
Limit query results to those previous to the specified endkey: endkey=
Last document id to include in the output: endkey_docid=
Limit the number of documents in the output: limit=
Prevent CouchDB from refreshing a stale view: stale="ok" stale="update_after" Reverse the output: descending=True descending=False (default value) Note that the descending option is applied before any key filtering, so you may need to swap the values of the startkey and endkey options to get the expected results. Skip the specified number of docs in the query results: skip=
(default value is 0) The group option controls whether the reduce function reduces to a set of distinct keys or to a single result row: group=True group=False (default value) group_level=
Use the reduce function of the view: reduce=True (default value) reduce=False Note that default value of reduce is True, only if a reduce function is defined for the view. Automatically fetch and include the document which emitted each view entry: include_docs=True include_docs=False (default value) Determine whether the endkey is included in the result: inclusive_end=True (default value) inclusive_end=False view_all_docs(self, **kwargs): Query the _all_docs view. Accepts the same keyword parameters as `view()`. temp_view(self, view_doc, **kwargs): Query a temporary view. The view_doc parameter is a dict with the view's map and reduce functions.
https://pypi.python.org/pypi/tornado-couchdb/0.2.3
Reply
Anonymous
Information Epoch 1753213216
Files are bags of bytes.
Home
Notebook
Contact us