Skip to content

incoming handler runs twice when using .bulkDocs() #55

Closed
@garbados

Description

@garbados

Since PouchDB 6.0.3, the incoming handler runs twice when using the .bulkDocs method. You can demostrate this issue with this snippet:

const PouchDB = require('pouchdb')
PouchDB.plugin(require('transform-pouch'))

const db = new PouchDB('.test')
let i = 0
db.transform({
  incoming: function (doc) {
    i++
    return doc
  }
})

Promise.resolve().then(async () => {
  await db.bulkDocs([{ _id: 'a' }])
  console.log(i === 2)
}).catch((err) => {
  console.error(err)
}).then(db.destroy)

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