couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David King <>
Subject Re: General-understanding questions about views
Date Sun, 29 Jun 2008 03:35:51 GMT
> Feel free to send in more questions as they come :-)

Okay, I have another one :)

How are views with a reduce function affected by deletes and updates?  
Given the example (<>) of:

     "total_purchases": {
       "map": "function(doc) { if (doc.Type == 'purchase')   
emit(doc.Customer, doc.Amount) }",
       "reduce": "function(keys, values) { return sum(values) }"

How would that total be updated if something were deleted or updated?  
Does the sum() function have to be evaluated over doc.Amount of  
*every* doc on every update?

View raw message