couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <wikidi...@apache.org>
Subject [Couchdb Wiki] Update of "HTTP_view_API" by JanLehnardt
Date Wed, 01 Dec 2010 11:17:59 GMT
Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification.

The "HTTP_view_API" page has been changed by JanLehnardt.
The comment on this change is: add include_docs performance trade off.
http://wiki.apache.org/couchdb/HTTP_view_API?action=diff&rev1=48&rev2=49

--------------------------------------------------

  
  If a view contains both a map and reduce function, querying that view will by default return
the result of the reduce function. The result of the map function only may be retrieved by
passing ''reduce=false'' as a query parameter.
  
- The ''include_docs'' option will include the associated document. However, the user should
keep in mind that there is a race condition when using this option. It is possible that between
reading the view data and fetching the corresponding document that the document has changed.
If you want to alleviate such concerns you should emit an object with a _rev attribute as
in ''emit(key, {"_rev": doc._rev})''. This alleviates the race condition but leaves the possibility
that the returned document has been deleted (in which case, it includes the ''"_deleted":
true'' attribute).
+ The ''include_docs'' option will include the associated document. However, the user should
keep in mind that there is a race condition when using this option. It is possible that between
reading the view data and fetching the corresponding document that the document has changed.
If you want to alleviate such concerns you should emit an object with a _rev attribute as
in ''emit(key, {"_rev": doc._rev})''. This alleviates the race condition but leaves the possibility
that the returned document has been deleted (in which case, it includes the ''"_deleted":
true'' attribute). '''Note''': ''include_docs'' will cause a single document lookup per returned
view result row. This adds significant strain on the storage system if you are under high
load or return a lot of rows per request. If you are concerned about this, you can emit the
full doc in each row; this will increase view index time and space requirements, but will
make view reads optimally fast.
+ 
  
  The ''inclusive_end'' option controls whether the ''endkey'' is included in the result.
It defaults to true.
  

Mime
View raw message