Closed vladar closed 2 years ago
I don't think I intended to indicate that that was supported in the docs. The start
and end
are interpreted as ranges for the keys, not values (and that stored doesn't have any numeric keys). However, this seems like a good idea, and LMDB itself does support this types of cursor searches, so I will look into adding it (probably be a little ways out in a major version release).
Is there any workaround at a lower-level, maybe node-lmdb db/cursor for something like this for now?
I can probably workaround this with a binary search using getValuesCount
and offset
. But curious if getValuesCount
makes sense in this context or maybe it's the same as just iterating through all values.
getValuesCount
does iterate the cursor, but it doesn't return or deserialize any values, which makes it faster. The next version of lmdb-store I am working is streamlining the cursor iteration to reduce the number of native calls that are required for each iterating, which should make it faster, and that's where I was going to add support for the value ranges.
This should now be working and available in beta of v1.6.
Docs mention that when using
dupSort
it is possible to filter out values by range usinggetValues
.But it doesn't work for me (or maybe am I misinterpreting how this feature is supposed to work). Here is a repro: