Search code examples
couchbaseduplicatescouchbase-view

Couchbase view returns duplicate document


I have a simple "account" document with the following view:

function (doc, meta) {
  if ( doc.entityType === 'account' &&  doc.status != "DELETED" ) {
    emit(meta.id, null);
  }
}

Sometimes, (quite often), after adding an entry I get duplicate entries when query the db using that view. These entries are identical including their meta data.

Once the view retrieve a duplicate entry it will always return it as duplicate (the issues is consistently).

When checking the entries in the bucket I can see only one entry of this id thus the duplication is only in the view.

Once I create another view or delete and recreate this view, all duplicated entries are gone.

I'm using Couchbase 3.0.0 Enterprise Edition (build-1118)


Solution

  • This was a bug in version 3.0.0 that has since been fixed: https://issues.couchbase.com/browse/MB-12110 Upgrade to the latest version (3.0.2 as of this writing) and that should solve the problem.