using Couchbase; using NLog.Extensions.Logging; using Couchbase.KeyValue; using Couchbase.Transactions; using Couchbase.Transactions.Config; using static Couchbase.Core.Diagnostics.Tracing.OuterRequestSpans.ManagerSpan; var loggerFactory = new NLogLoggerFactory(new NLogProviderOptions { CaptureMessageTemplates = true, CaptureMessageProperties = true }); var clusterOptions = new ClusterOptions() .WithCredentials("Administrator", "password") .WithLogging(loggerFactory); var cluster = await Cluster.ConnectAsync("couchbase://localhost", clusterOptions); var bucket = await cluster.BucketAsync("deleteFromList"); var collection = await bucket.DefaultCollectionAsync(); // create a list var list = collection.List("doc1"); await list.AddAsync(new Foo { Id = 123, Name = "Matt" }); await list.AddAsync(new Foo { Id = 456, Name = "Richard" }); await list.AddAsync(new Foo { Id = 789, Name = "Jeffry" }); Console.WriteLine($"There are now {await list.CountAsync} items in the `doc1` list"); Console.WriteLine("Press ENTER to continue..."); Console.ReadLine(); var richard = list.SingleOrDefault(x => x.Name == "Richard"); await list.RemoveAsync(richard); Console.WriteLine($"After Remove Async, there are now {await list.CountAsync} items in the `doc1` list"); public class Foo { public ulong Id { get; set; } public string Name { get; set; } }