Posts

Showing posts with the label couchdb

CouchDB Ruby Libraries

This is a quick list of CouchDB Ruby libraries. Need to connect Ruby to CouchDB? Try one of these! CouchRest - hosted at GitHub, this library by Chris Anderson (jchris) , has a low level component and a high level component. RelaxDB - also hosted at GitHub, this library provides a base class that your models will extend (similar to the high level component provided by CouchRest.) RelaxDB adds pagination support as well as has_many and belongs_to relationship support. CouchObject - this library is unique because it is implemented as a module, to be included in your model class. This library also has both low level and high level components. Basic Model - from topfunky, this library was featured in the PeepCode CouchDB episode . Your model classes extend BasicModel. ActiveCouch - tries to look like ActiveRecord. Supporting a simple find method to query views. Views are defined as Ruby classes, and loaded via rake tasks. CouchFoo - attempts to replication ActiveR...

A Count(*) View for CouchDB

I've been working with CouchDB a lot lately. The first thing I tried to do, after I loaded 1,000,000 records, is to do the equivalent of count(*) . Below is the view I used to implement a "count how many records I have in this database" or "count all": { "_id": "_design/counts", "language": "javascript", "views": { "all": { "map": "function(doc) { emit(null, 1); }", "reduce": "function(keys, values, combine) { return sum(values); }" } } }