Search:

Search all manuals
Search this manual
Manual
Couchbase Client Library: PHP 1.1
Community Wiki and Resources
Wiki: PHP Client Library
PHP Client Library
Couchbase Developer Guide 2.0
Couchbase Server Manual 2.0
SDK Forum
Additional Resources
Community Wiki
Community Forums
Couchbase SDKs
Parent Section
Couchbase Client Library: PHP 1.1
Chapters

Chapter 9. Finding Data with Views

In Couchbase 2.0 you can index and query JSON documents using views. Views are functions written in JavaScript that can serve several purposes in your application. You can use them to:

For more information on views, see Couchbase Developer Guide, Finding Data with Views, and Couchbase Sever 2.0: Views and Indexes.

API Call$object->view($ddocname [, $viewname ] [, $viewoptions ])
Asynchronousno
DescriptionExecute a view request
Returnsarray; supported values:
 failure: Array containing error information  
 success: Array of the requested view request results  
Arguments 
$ddocnameDesign document name
$viewnameView name within a design document
array $viewoptionsView options
Errors 
CouchbaseAuthenticationExceptionAuthentication to the Couchbase cluster failed
CouchbaseExceptionBase exception class for all Couchbase exceptions
CouchbaseLibcouchbaseExceptionAn error occurred within the libcouchbase library used by th PHP extension
CouchbaseServerExceptionAn error occurred within the Couchbase cluster
API Call$object->viewGenQuery($ddocname [, $viewname ] [, $viewoptions ])
Asynchronousno
DescriptionGenerate a view request, but do not execute the query
Returnsscalar; supported values:
 object: Generated view request  
Arguments 
$ddocnameDesign document name
$viewnameView name within a design document
array $viewoptionsView options
Option nameValue type 
descendingboolean; optional 
endkeystring; optional 
endkey_docidstring; optional 
full_setboolean; optional 
groupboolean; optional 
group_levelnumeric; optional 
inclusive_endboolean; optional 
keystring; optional 
keysarray; optional 
limitnumeric; optional 
on_errorstring; optional 
 Supported Values 
 continue: Continue to generate view information in the event of an error, including the error information in the view response stream. 
 stop: Stop immediately when an error condition occurs. No further view information will be returned. 
reduceboolean; optional 
skipnumeric; optional 
stalestring; optional 
 Supported Values 
 false: Force a view update before returning data 
 ok: Allow stale views 
 update_after: Allow stale view, update view after it has been accessed 
startkeystring; optional 
startkey_docidstring; optional