You cannot receive all documents. Create one โconstantโ atomic integer value that will be counter as follows:
CouchbaseClient oclient; oclient= new CouchbaseClient("vwspace", "");// data bucket name ulong results = (ulong)oSourceBucket.Get("MYCOUNTER");// counter (integer incremental value)
When you add documents to the bucket, do not add them with some documentId (I suppose you get this SQL database or something similar), but create them using counter as follows:
results = oSourceBucket.Increment("MYCOUNTER", results, 1);// counter (integer incremental value) oSourceBucket.Store(StoreMode.Add, "MYITEM." + results.toString(), myNewObjectToStore);
Now you can simply use the for loop for oSourceBucket.Get(...) all elements up to the MYCOUNTER value. I'm not sure that the new version of Couchbase 2.0 will have a template, but the current stable version (1.8.1, I think) allows you to get only the exact key.
Remember this storage is KEY-VALUE, not SQL :)
There is also MultiGet in Couchbase, but it does not exist in the latest stable version of the .NET client, but it is used under the hood just like a for... loop with several Get -s.
source share