These examples are intended to be linked to from within the developer guide. They are currently cross-referenced by language.
Each example should be fully self-contained and executable. For languages which have a significant setup, the example may be split into multiple files, but should still be executable. Error handling is optional but should be be at least hinted at.
This example should show how to connect to a remote Couchbase cluster and bucket
C | Python | Java| .NET | Go | node.js
This example should show how to store an item into a cluster
C | Python | Java | .NET | Go | node.js
This example should show how to get items out of the cluster
C | Python | Java | .NET | Go | node.js
This example should show how to initialize and update a counter
C | Python | Java | .NET | Go | node.js
This example should show how to initialize a document with an Expiry or "ttl" - time to live
C | Python | Java | .NET | Go | node.js
This example should show how to perform a simple query against the travel-sample bucket. The query is something like:
query = N1QLQuery('SELECT airportname, city, country FROM `travel-sample` '
'WHERE type="airport" AND city="Reno"')
C | Python | Java | .NET | Go | node.js
This example should demonstrate how to use placeholders, and also the advantages they afford, perhaps by abstracting a given query away as a function, and passing a function parameter down as a query parameter
C | Python | Java | .NET | Go | node.js
This example should show how the scan_consistency
parameter may be enabled for a specific query.
C | Python | Java | .NET | Go | node.js
This example will demonstrate concurrent mutations with and without using the CAS value. Without using the CAS value, some modifications may end up getting lost, whereas using the CAS within a proper retry mechanism will ensure that all mutations remain in tact
C | Python | Java | .NET | Go | node.js
Shows storing an item with durability requirements, attempting to persist/replicate to the maximum number of nodes available.
Some SDKs provide APIs to determine how many nodes are in the cluster, while some SDKs allow dynamically persisting to the total number of nodes available, while others only allow fixed numbers. More details may be found in the examples.