CFCouchbase SDK
Search…
Filter Closures
You can specify a closure as the filter argument that returns true for records that should be included in the final output. This is a great way to filter out any unecessary documents you do not want in the end result array.
1
// Only return breweries
2
results = client.query(
3
designDocumentName = 'beer',
4
viewName = 'brewery_beers',
5
filter = function( row ){
6
if( row.document.type == 'brewery' ) {
7
return true;
8
}
9
return false;
10
}
11
);
Copied!
Last modified 3yr ago
Copy link
Edit on GitHub