Skip to content

Support a db.has(key) method for testing whether a key exists in the database #66

Closed as not planned
@aaclayton

Description

@aaclayton

For context, I am using https://github.com/Level/classic-level/ but I decided to create this issue here because it should have value for all implementations.

Currently the best available method to test whether a record exists within the database for a particular key is to read the full value of the record using await db.get(key). You can instead iterate over db.keys(), but this is much slower.

It would be nice to have a more lightweight (and potentially even faster) method to assert the existence of a specific key like await db.has(key) which would return a boolean for whether a record exists with that key.

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