Matt Palmerlee
Matt Palmerlee

Reputation: 2668

Get bucket item count in Couchbase

I'm just getting started experimenting with Couchbase (v1.8) using the .NET client. I can't figure out how to get a basic count of items I've stored in the default bucket.

My storage code is pretty simple:

var client = new CouchbaseClient();
var session = new Session { SessionId = "session_1234" };
client.Store(StoreMode.Add, sessionId, session);

But now I just want to get a count of all the sessions I've stored in my couchbase bucket. I've looked at the .NET API docs and can't seem to find a way to do this.

Upvotes: 0

Views: 1765

Answers (1)

John Zablocki
John Zablocki

Reputation: 1592

Currently, the client doesn't support getting an item count from buckets. I've done some work recently to start a basic bucket API. I've created a ticket for adding the item count - http://www.couchbase.com/issues/browse/NCBC-92.

If you're interested in where that count would come from, it's available over the HTTP API - http://127.0.0.1:8091/pools/default/buckets/default <- bucket name is at the end of the path

If you're new to Couchbase Server, I'd suggest starting out with Couchbase Server 2.0 Developer Preview 4 - http://www.couchbase.com/download. You could then use views to count session documents.

More information about 2.0 is found at http://www.couchbase.com/develop/net/next.

-- John

Upvotes: 3

Related Questions