_pear_
Deno3y ago
_pear

KV list is returning an empty iterator, but data is there and gettable via get

Hello. To simplify things, I am setting a key of
["accounts", account.name]
but when I try to get the accounts with
kv.list({ prefix: ["accounts"] })
, I always get an empty iterator back. I am able to see the record exist when using
kv.get()
.

Here are the relevant snippets; what am I doing wrong, or is this a bug?:

const Db = await Deno.openKv();
//...
await Db.set(["accounts", account.username], account);

//...
const iter = Db.list({ prefix: ["accounts"] }); // why is this always empty?
    for await (const row of iter) {
  console.log(row);
    }
Was this page helpful?