Does 3.x library has an endpoint to get multiple document by passing a list of id'ss

I am migrating couchbase library to 3.x. And I am looking for an endpoint similar to Task<IDocumentResult[]> GetDocumentsAsync(IEnumerable ids) the one we had in 2.x library , which I can use for fetching multiple documents at the same time. Does 3.x library has an endpoint to get multiple documents by passing a list of id’s?

@Lal_John For various reasons, this method was dropped from SDK 3.x in favor of using task-based parallelism. For example:

var tasks = myListOfKeys.Select(p => collection.GetAsync(p)).ToArray();

var results = await Task.WhenAll(tasks);

There are also other ways to do this, for example using System.Linq.Async and IAsyncEnumerable, depending on your use case.

The only caveat I would add is that this pattern can be problematic if you are getting a very large number of documents, as it will trigger all of the requests simultaneously. If you’re getting more than a few dozen documents, I’d recommend doing something to partition or batch the requests.


Thanks for the updates.

Just a random question, As I am new to the couchbase , It would be helpful if can share your thoughts on Unable to fetch data form couchbase cluster deployed in kubernetes