ReadTransaction.scan ignores limit option when an indexName is provided
arv opened this issue · comments
https://discord.com/channels/830183651022471199/1050431029602697226/1050431029602697226
In a useSubscribe
query, I have the following:
const countWithoutIndex = (
await txn
.scan({
limit: 1,
})
.entries()
.toArray()
).length;
const countWithIndex = (
await txn
.scan({
indexName: "foo",
limit: 1,
start: {
key: ["bar"],
},
})
.entries()
.toArray()
).length;
I observed that countWithoutIndex
is always 1 (respecting the limit option as expected), but countWithIndex
is not 1. It seems that the scan iterator does start at the provided index value ("bar"), but it doesn't stop at the given limit.