Re: [IndexedDB] Behavior of IDBObjectStore.get() and IDBObjectStore.delete() when record doesn't exist

On Monday, November 8, 2010, Keean Schupke <keean@fry-it.com> wrote:
> Hi,
> Indeed. But I think this is more unexpected and confusing than having
> .get() return the same thing if the entry exists as if it contains
> undefined.
>
> / Jonas
>
> I don't understand that.
> with the proposal, undefined clearly means the entry does not exist as there is no way to put an undefined into the object store (as .put(undefined, key) deletes the entry).

The confusing part is that a function called 'put' actually deletes
something, especially since we also have a 'delete' function.

I would put the question this way: What problem are you trying to
solve? If the problem is that people can't store "undefined" and then
tell "undefined" apart from "not there" then your proposal doesn't
solve that problem as "undefined" can't be stored at all.

Additionally, as was mentioned, you can still tell "undefined" from
"not there" by using a cursor.

/ Jonas

Received on Monday, 8 November 2010 19:36:05 UTC