A List is a .NET data structure that is held in memory. With the data structures provided by the Couchbase .NET SDK, you can store it in a Couchbase document.

The string “myList” corresponds to the key for the document that will contain the list. When using CouchbaseList , a single document with that key will be created (if one doesn’t exist already). If a document by that key already exists, CouchbaseList will use it.

You can now add/remove items from the list and that will all be persisted to the document. You can also perform other operations like getting a count of the items in the list.

// add 10 objects to the list for(var i = 0; i < 10; i++) list.Add(new { num = i, foo = "bar" + Guid.NewGuid()}); // remove an item from the list by index list.RemoveAt(5); // show an item from the list by index var item = list[5]; Console.WriteLine("5th item in the list: " + item.foo + " / " + item.num);

The above code would result in a document with a key “myList” that looks like below. Notice that the item with num of 5 is not listed, because it was removed.