Home > Mobile >  In immudb, can we know if a certain key is available before we do the `Get` query?
In immudb, can we know if a certain key is available before we do the `Get` query?

Time:03-12

I have began to do some experiments with immudb. I am inserting some data and it is inserting fine there. However, if I try to get a value like this :

const getRes = await cl.get(getReq);

I get an error "Key not Found". How can I know if a certain key is available before I do the Get query?

CodePudding user response:

There is no "exists" operation exposed by immudb but it shouldn't be an issue to receive "key not found" error.

Disclaimer: I'm an active immudb contributor, please feel free to open an issue for this API at immudb GitHub repo.

CodePudding user response:

Depending on your use case, sometimes you can use a scan operation. It will give you a list of keys matching given prefix. That could be useful if you work on set of values sharing common prefix.

  • Related