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.
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 overdb.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 aboolean
for whether a record exists with that key.