I'm using BDB cursor and calling getSaerchKeyRange. From the docs
getSaerchKeyRange: returns the smallest key greater than or equal to the specified key
Lets say our DB is the following
Key Value
1 a
2 b
3 c
4 d
5 e
After running cursor.getSearchKeyRange(6) does the cursor
- point to 5
- one record past 5 (which is null? because there are no more records)
- stay where it was (if this was the first search then its null?)
So far I've tried reading multiple sources of documentation but the answer isn't clear to me.
It returns "not found". The way it returns "not found" depends on which programming language you're using. If you're using Java, it returns
OperationStatus.NOTFOUND.In your example, there are no keys in the database that are greater than or equal to your search key of 6. This line in the documentation describes the behavior:
To round this out, expand on your example by adding some more larger keys:
Now, if you do a
getSearchKeyRange(6), it returns key37. That's the first key that's greater than or equal to 6.