Skip to content

memory adapter can report incorrect total_rows #8925

@alxndrsn

Description

@alxndrsn

Browser: webkit

Observed

There appears to be a race condition in pouchdb-adapter-memory which means that the result of allDocs() can sometimes return a different value for total_rows vs result.rows.length.

Expected

Calling db.allDocs() without args should return a .rows array prop with length equal to returned .total_rows value.

Example

build: https://github.com/pouchdb/pouchdb/actions/runs/8567263981/job/23559252499

logs

   1 failing

  1) test.all_docs.js-http
       test total_rows with a variety of criteria * 100:

      correctly return total_rows
      + expected - actual

      -801
      +800
      
  @http://127.0.0.1:8000/tests/integration/test.all_docs.js:489:36

Test Code

        return db.allDocs();
      }).then(function (res) {
        res.rows.should.have.length(800,  'correctly return rows');
        res.total_rows.should.equal(800,  'correctly return total_rows');

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions