GetMulti returns null

I am using couchbase version 2.2.0 community edition and couchbase nodejs client lib version 1.2.1

I have created a view that returns all the documents of type 'Brand'

Here is my view code :

function (doc, meta) {
  if (doc.type && doc.type == "Brand" && doc.isDeleted == false) {
          emit(doc.type, null);
      }
}

I have 12 documents of type Brand

I am using getMulti method
Here is my code:

var q = {
      stale: false
   };
 
   req.cb.view("Brand", "ByType", q).query(function (err, values) {
 
      var keys = _.pluck(values, 'id');
      console.log(keys);      //It returns all 12 keys
      req.cb.getMulti(keys, null, function (err, results) {
 
         var brands = _.map(results, function (v, k) {
            return v.value;
         });
 
         res.send(brands);
      });
   });

When I call this from fiddler, it is behaving strangely. Sometimes it returns all 12 documents and many times it returns some documents as null.
I am not able to figure out where it is causing a problem.

When the documents of a particular type exceeds 10, it is causing same problem.

Am I making some mistake? Please guide me.
Its really urgent.

Thanks
Regards
team.avesta

0 Answers

No answers yet