Couchbase Server's key/value API includes standard CRUD operations, and each of the SDKs contains corresponding CRUD methods. We'll begin our API exploration by demonstrating how to insert and retrieve a record from our default bucket. If you're following along, make sure you read the Getting Started guide's description on how to configure your client for use.
Before reading from or writing to a Couchbase Server bucket, you must first configure your client. The basic setup is consistent across all SDKs. You first connect to the cluster and then open a connection to a bucket, as follows:
var cluster = new Cluster(); var bucket = cluster.OpenBucket();
In the preceding C# snippet, the client assumes that the cluster is located on localhost (127.0.0.1
), and the bucket you're connecting to is default
. You can also set these values explicitly, like this:
var cluster = new Cluster("127.0.0.1"); var bucket = cluster.OpenBucket("default");
If you have multiple...