I need to get all bucket names in a server. I am using .net SDK for Couch base connection.
Can you please tell me a solution for this.
I need to get all bucket names in a server. I am using .net SDK for Couch base connection.
Can you please tell me a solution for this.
Just a point of clarificatin: buckets are spread across a cluster, they aren’t necessarily on a single server.
That being said, here’s one way to do it with the Couchbase .NET SDK:
var cluster = new Cluster(new ClientConfiguration
{
Servers = new List<Uri> {new Uri("http://localhost:8091")}
});
cluster.Authenticate("Administrator", "password");
var clusterMan = cluster.CreateManager("Administrator", "password");
var buckets = clusterMan.ListBuckets().Value;
foreach (var bucket in buckets)
{
var bucketName = bucket.Name;
}