couchbase-net-beersample
The official "Beer Sample" example application using the Couchbase .NET SDK 2.0
NOTE: This is an older example that has been updated to work with Couchbase Server 5.0+. However a more complete example that demonstrates additional Couchbase Server features is the Travel Sample.
NOTE: This is not an officially supported Couchbase project.
Authentication
With Role Base Access Control introduced in Couchbase Server 5.0, it is necessary to authenticate the SDK with the cluster using a discrete username and password combination. The username and password can be added in the web.config under the "couchbase" section. If using a Couchbase Server version before RBAC was added, you must leave these values empty.
Couchbase Server URI
The Couchbase Server URI can be updated in the web.config under the "couchbase" section and the default is to use "localhost".
Views
This example uses a custom View definition to list all available beers and will need to be added manually. You can follow these steps to add the definition:
- Navigate to the View definitions page in the cluster manager
- Copy the Beer design document to development
- Add a new view to the Beer design document called "all_beers"
- Copy and paste the definition below into the new view definition
- Publish the Beers design document, overwriting the existing one if prompted.
function (doc, meta) {
if (doc.type == "beer") {
emit(meta.id, doc);
}
}