How to check whether a bucket exist or not?


#1

I have reading the documentation and googling about it but could not find a way on how to find whether a bucket exist or not? Could someone please help me?


#2

sherryyummen-

You can use the CouchbaseCluster object like this:

var config = new CouchbaseClientConfiguration(); var cluster = new CouchbaseCluster(config); Bucket bucket = null; if (cluster.TryGetBucket("default", out bucket)) { //Bucket exists }

There are also other methods like ListBuckets() which you can use to check for the existence of a Bucket in the returned list.

-Jeff