lib/implementation.js
function workflowGuidWorkflowLocale() {
      return self.apos.docs.db.ensureIndex({ workflowGuid: 1, workflowLocale: 1 }, { sparse: 1, unique: 1 })
        // eslint-disable-next-line handle-callback-err
        .catch(function(err) {
          return resolveDuplicateDocs()
            .then(function() {
              // now we can try the index again, recursively
              return workflowGuidWorkflowLocale();
            });
        });
    }
function workflowGuidWorkflowLocale() {
      return self.apos.docs.db.ensureIndex({ workflowGuid: 1, workflowLocale: 1 }, { sparse: 1, unique: 1 })
        // eslint-disable-next-line handle-callback-err
        .catch(function(err) {
          return resolveDuplicateDocs()
            .then(function() {
              // now we can try the index again, recursively
              return workflowGuidWorkflowLocale();
            });
        });
    }
Early versions did not have this index and thus could violate the uniqueness of the guid.locale pair under rare race conditions. If the index fails, resolve the duplicates and try again