Get() Should accept a default value to be returned when key is not found
KrishnaPG opened this issue · 2 comments
KrishnaPG commented
Lines 197 to 199 in 0f2f2e7
When the key is not found, currently the code always returns null
. It should accept a default value to be returned, instead, when the given key is not found. For example:
get(key, defVal) {
if(key is not found) return defVal;
}
Venemo commented
If you desire a default value, you can use JavaScript.
var value = txn.getString(dbi, 42) || "Your default value"
I don't think it's a good idea to bloat node-lmdb with such features, but if you feel like implementing it, a pull request is always welcome.
Venemo commented
I hope the answer I provided is clear. I'm closing this issue now due to lack of response from the OP.