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

Limit 0 or null as parameter should return all records #5807

Open
dszymczuk opened this issue May 31, 2016 · 4 comments
Open

Limit 0 or null as parameter should return all records #5807

dszymczuk opened this issue May 31, 2016 · 4 comments

Comments

@dszymczuk
Copy link

Example (I use rethinkdbdash):

r.table(tableNotification).orderBy(r.desc('time')).limit(limit)
is better than:

if(limit > 0){
    r.table(tableNotification).orderBy(r.desc('time')).limit(limit).run()
} else {
    r.table(tableNotification).orderBy(r.desc('time')).run()
}

After comment @danielmewes in rethinkdb/docs#1133 I think, that null will be good to get all records.
Also nth and skip should the same option.

@danielmewes
Copy link
Member

Thanks for re-opening the issue here.

I'm marking this as a ReQL_proposal. We'll discuss it for one of the upcoming releases.

@VeXocide
Copy link
Member

I agree with @danielmewes that we shouldn't special case 0 and have limit(0) return zero documents, that's what you've asked for after all. Adding support for limit(null) on the other hand sounds reasonable.

Not sure what nth(null) would do though, and I'm not sure there's much use for a skip(null) that skips all documents either.

@neonrust
Copy link

neonrust commented Jun 1, 2016

I think, at least limit(null) and skip(null) have intuitive English meanings; "no limit" and "skip nothing"... (and as usual :) even more intuitive in Python: limit(None) and skip(None))
However, nth(null) is less intuitive... if it even makes any sense?

@dszymczuk
Copy link
Author

I would like to focus on limit. Because when I want to use limit, I have to use construction with "if" as above.
It's not comfortable :)

You're right - nth doesn't make sense.

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

No branches or pull requests

4 participants