.NET SDK 2.1
The .NET Couchbase SDK provides a way to store and retrieve your objects to and from a Couchbase cluster.
The .NET Couchbase SDK can be used via a synchronous or asynchronous interface.
Here’s a sampling of what you can do with the Couchbase .NET SDK:
Storing Documents
You can store items by using the Upsert<T>
method.
This method serializes your data structure and stores it on the cluster.
To store a document, just create a new Document
object, and fill in the fields you need:
var doc = new Document<string>() {
Id = "document_id",
Content = "Hello World!"
};
You can store anything serializable in the Content
field, not just strings.
After the document has been created, you can store it in the cluster by using the Upsert
method:
bucket.Upsert(doc);
Upsert is a combination of insert and update and will either replace an existing item if it exists, or create it anew if it’s not yet present.