Inconsistent View Results

I am running into an issue where query results from a view are inconsistent when using the Java Couchbase Client 1.1. I run the same query directly in a browser and I get consistent results. I have run the query on each of the three nodes in the cluster; debugging shows that each node has returned inconsistent results through the java client, but in a browser the results are consistent for each node.

Here is the map:

function (doc, meta) {
  var data =;
  if(data) {
    emit([data.company_number, data.status], {
      applicationNumber: data.application_number,
      status: data.status});

And the reduce:

function(keys, values, rereduce) {
  var index;
  var maxApp = {applicationNumber:""};
  for (index in values) {
    if (values[index].applicationNumber > maxApp.applicationNumber) {
      maxApp.applicationNumber = values[index].applicationNumber;
      maxApp.formId = values[index].formId;
      maxApp.status = values[index].status;
  return maxApp;

The unreduced results are:


Sometimes the java client returns the "30951-00001" application number incorrectly, and other times the "30951-00002" correctly - as if sometimes it doesn't know about the "30951-00002" row.

Any ideas?

1 Answer

« Back to question.


Were you able to identify the source of the problem?
Have you tested with debug enabled?