Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ReadTransaction.scan ignores limit option when an indexName is provided #1039

Open
arv opened this issue Dec 8, 2022 · 0 comments
Open

ReadTransaction.scan ignores limit option when an indexName is provided #1039

arv opened this issue Dec 8, 2022 · 0 comments

Comments

@arv
Copy link
Contributor

arv commented Dec 8, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant