Skip to content

Events on root propagate pre-encoded value #36

Open
@martinheidegger

Description

@martinheidegger

The events propagated on sub-level instances do not have their value encoded, unlike events triggered by sublevel pushes.
Is this correct behavior?

const db = new Level('db')
await db.open()
db.on('put', (key, value) => {
  // { key: 'hello', value: { world: 'foo' } }
  // { key: '!sub!hello', value: '[object Object]' }
  console.log({ key, value })
})
const sub = db.sublevel('sub')
await db.put('hello', { world: 'foo' })
console.log(await db.get('hello'))
await sub.put('hello', { world: 'foo' })
console.log(await sub.get('hello'))

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentationpull request welcomeA pull request is welcome

    Type

    No type

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions