Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
aaclayton opened this issue Jan 16, 2023 · 2 comments

Comments

@aaclayton
Copy link

aaclayton commented Jan 16, 2023

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.

@vweevers
Copy link
Member

Duplicate of Level/community#106

@vweevers vweevers marked this as a duplicate of Level/community#106 Jan 16, 2023
@vweevers vweevers closed this as not planned Won't fix, can't repro, duplicate, stale Jan 16, 2023
@aaclayton
Copy link
Author

Sorry I did not notice this issue in the other repo backlog. Thanks for the redirect.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants