Managing Views
// application start
boolean function onApplicationStart(){
application.couchbase = new cfcouchbase.CouchbaseClient( { bucketName="beer-sample" } );
// Specify the views the applications needs here. They will be created/updated
// when the client is initialized if they don't already exist or are out of date.
application.couchbase.saveView(
'manager',
'listBreweries',
'function (doc, meta) {
if ( doc.type == ''brewery'' ) {
emit(doc.name, null);
}
}',
'_count'
);
application.couchbase.saveView(
'manager',
'listBeersByBrewery',
'function (doc, meta) {
if ( doc.type == ''beer'' ) {
emit(doc.brewery_id, null);
}
}',
'_count'
);
return true;
}Last updated
Was this helpful?