Login

Tag "couchdb"

Snippet List

Get email and push on couchdb - Model

view/admin.py ` def reactor(request): context = { 'email': read_mailbox() } return render_to_response(_lookup_template('dashboard'), context, context_instance=RequestContext(request)) ` **_Design all.js** ` function (doc) { if (doc.doc_type == 'MailArchive') { emit(doc._id, doc); } } ` **reduce.js** `_count`

  • email
  • couchdb
  • couchdbkit
Read More

Convert a Couchdb document into a Python object

Originally posted by [Leah Culver on her blog](http://leahculver.com/2008/11/25/couchdb-documents-python-objects/). This allows you to convert a CouchDB document into a python object and work on CouchDB fields as if they were properties of a python object.

  • python
  • couchdb
Read More

Example usage of SimpleCouchPaginator

Example Usage of [Very basic CouchDB Paginator](http://www.djangosnippets.org/snippets/1208/) An Example setup of CouchDB with django can be found at: [Eric Florenzanos post about django+couchdb](http://www.eflorenzano.com/blog/post/using-couchdb-django/)

  • pagination
  • paginator
  • couchdb
  • example
Read More

Basic CouchDB Paginator (Updated)

This is a very basic paginator for CouchDB ViewResults. It's usage is similar to the django one. **CouchPaginator** is almost like the django version with one exception: It's constructor needs an additional argument `pages_view` which is either a reduce result or an integer which holds the total number of objects across all pages. *Example Map/Reduce for pages*: > map = function(doc) { > if(doc.type=="application" || doc.type==\"inquiry\"){ > emit([doc.meta.user.toLowerCase(), doc.type], 1); > } > reduce = function (doc, value, rereduce){ > return sum(value); > } **SimpleCouchPaginator** is much simpler and needs no total number and can only paginate by "next" and "previous" page. Use this if you don't have an reduce view which tells you the amount of total object. An Example setup of CouchDB with django can be found at: [Eric Florenzanos post about django+couchdb](http://www.eflorenzano.com/blog/post/using-couchdb-django/) [See example usage](http://www.djangosnippets.org/snippets/1209/)

  • pagination
  • paginator
  • couchdb
Read More

6 snippets posted so far.