incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nick Poulden <n...@domine.co.uk>
Subject Reduce Only
Date Thu, 07 Oct 2010 02:10:22 GMT
Hi,

Is it possible to *only* store the reduce value of a view?

I'm storing a large database of orders for my online takeaway ordering
website and collating stats, specifically the number of times a particular
dish has been ordered. The view looks something like this:

// Map
function(doc) {
  if(doc.restaurant_id && doc.order_items) {
    for(var i=0; i< doc.order_items.length; i++) {
      emit([doc.restaurant_id, doc.order_items[i].title], 1)
    }
  }
}

// Reduce
function(keys, values, rereduce) {
  return sum(values);
}

The problem is that there are tons of documents in the view index that
aren't much use and view indexing is taking about 10 times longer since I
added this function. The only thing I want to store is the reduce value. Is
that possible, or is it a feature that may be added at some point in the
future?

Thanks,

Nick Poulden
http://www.e-resistible.co.uk

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message