.net Client get multi keys error


#1

I have used a lastest client library of .NET (CouchbaseNetClient 2.1.3) . when use get multi key function I get a problem.

this method: public IDictionary<string, object> Get(IEnumerable keys);

If some keys in list is missing so first request no result return, from second request it will return right result.

Example:

string[] listKey = new string[] { “doc-1”, “doc-2”, “doc-3”,“doc-4” };
IDictionary<string,object> res= CouchCA_Data.Instance.Get(listKey);
int count = res.Count;

if any document don’t exists in listkey for example “doc-1” is not exists,

First request count= 0; but after that try request againt count =3;

I think have a problem with Couchbase client.


#2

@xmediateam -

This seems to work as expected:

using (var bucket = _cluster.OpenBucket())
     {
         var listKey = new List<string> { "doc-1", "doc-2", "doc-3", "doc-4" };
         var res = bucket.Get<dynamic>(listKey);

         foreach (var result in res)
         {
             Console.WriteLine("{0}=>{1}", result.Key, result.Value.Status);
         }
     }

The results:

doc-2=>KeyNotFound
doc-3=>Success
doc-1=>Success
doc-4=>Success

Before I ran the code I added doc-1, doc-3, and doc-4…doc-2 was omitted, hence the key not found.

-Jeff