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

cursor.each throws "RqlDriverError: No more rows in the cursor" #3826

Closed
bittrance opened this issue Feb 24, 2015 · 7 comments
Closed

cursor.each throws "RqlDriverError: No more rows in the cursor" #3826

bittrance opened this issue Feb 24, 2015 · 7 comments
Assignees
Labels
Milestone

Comments

@bittrance
Copy link

The following code throws a no-more-rows exception on an empty table with npmjs.org node driver version 1.16.1.

var r = require('rethinkdb')
r.connect({ host: 'localhost', db: 'test' }).then(function(conn) {
    return r.table('testo').run(conn).then(function(cursor) {
        return cursor.each(function(err, rec) {
            console.log(err)
            console.log(rec)
        })
    }).done()
})

This is counterintuitive to me; I would expect .each() to iterate zero times on an empty result.

I don't have a system where I can easily downgrade right now, but I think this may be a regression as my test started failing after upgrade from 1.15 to 1.16?

@danielmewes danielmewes added this to the 1.16.x milestone Feb 24, 2015
@danielmewes
Copy link
Member

Thank you for the issue report @bittrance .
I think that is indeed a bug.

At least it doesn't match the documentation http://rethinkdb.com/api/javascript/each/ which says

If we need to know when the iteration is complete, each also accepts a second onFinished callback.

So I assume that if you only pass in one callback like in your example, it should simply stop calling that once the cursor is exhausted (or if it is exhausted from the beginning, never call the callback).

Ping @deontologician

@deontologician
Copy link
Contributor

Well, you're right it's a regression. I did a bisect and found 580e206 was the culprit, looking to find the cause now

@danielmewes
Copy link
Member

We should make another JS driver point release once this is merged.

@deontologician
Copy link
Contributor

Merged into next and v1.16.x

@danielmewes
Copy link
Member

@AtnNn can you please push out an update for the JS driver?

@AtnNn
Copy link
Member

AtnNn commented Feb 25, 2015

A new version of the JavaScript driver (1.16.2) has been released with this fix.

@deontologician
Copy link
Contributor

@bittrance Thanks for reporting this, and for the test, it was really useful in finding the problem quickly.

@AtnNn AtnNn modified the milestones: 1.16.x, 2.0 Mar 17, 2015
@AtnNn AtnNn modified the milestones: 1.16.3, 2.0 Mar 26, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants