Dear Wiki user,

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

The "Introduction_to_CouchDB_views" page has been changed by BrianCandler.
The comment on this change is: Note about equal keys and docids.
http://wiki.apache.org/couchdb/Introduction_to_CouchDB_views?action=diff&rev1=25&rev2=26

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

  
  For queries which are not meant to actually condense the amount of 
information you often can live without a reduce function. A common strategy is 
to get the data you are interested to select by in into the ''key'' part and 
then use ''startkey'' and ''endkey'' on the result.
  
+ == Equal keys ==
+ 
+ CouchDB actually stores the [key,docid] pair as the key in the btree. This 
means that:
+  * you always know which document the key and value came from (it's exposed 
as the 'id' field in the view result)
+  * view rows with equal keys sort by increasing docid.
+ 
+ If you assign your docids in a time-based way then you can get documents with 
equal keys in a natural oldest-to-newest order. Couchdb has a feature to do 
this, which you can enable in local.ini:
+ 
+ {{{
+ [uuids]
+ algorithm = utc_random
+ }}}
+ 
  == Lookup Views ==
  
- The second parameter of the ''emit()'' function can be ''NULL''. CouchDB then 
only stores the key in the view. If you use the document's ID here, you can use 
the view as a compact lookup mechanism and fetch the document's details, if 
needed, in subsequent requests.
+ The second parameter of the ''emit()'' function can be ''null''. CouchDB then 
only stores the [key,docid] in the view. You can use the view as a compact 
lookup mechanism and fetch the document's details, if needed, in subsequent 
requests or by adding parameter ''include_docs=true''
  
  == Complex Keys ==
  

Reply via email to