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

Implement limit method for MongoDB driver #499

Merged
merged 1 commit into from Feb 6, 2014

Conversation

Projects
None yet
2 participants
@nazriel
Contributor

nazriel commented Feb 6, 2014

My first naive implementation.
Seems to work good but I am still new to vibe.d internals so I am not sure if it's the best approach.

@s-ludwig

This comment has been minimized.

Show comment
Hide comment
@s-ludwig

s-ludwig Feb 6, 2014

Member

If you have the time, I'd like to suggest some improvements. In particular, the amount of returned documents per chunk should also be limited to the given limit and the cursor should be discarded when the limit is reached. I'll make some inline comments for this.

Member

s-ludwig commented Feb 6, 2014

If you have the time, I'd like to suggest some improvements. In particular, the amount of returned documents per chunk should also be limited to the given limit and the cursor should be discarded when the limit is reached. I'll make some inline comments for this.

@nazriel

This comment has been minimized.

Show comment
Hide comment
@nazriel

nazriel Feb 6, 2014

Contributor

@s-ludwig updated, hope I understood your correctly.

Contributor

nazriel commented Feb 6, 2014

@s-ludwig updated, hope I understood your correctly.

@s-ludwig

This comment has been minimized.

Show comment
Hide comment
@s-ludwig

s-ludwig Feb 6, 2014

Member

Looks good, except the zero case, which I would rather handle like this:

if (count > 0) {
    if (m_nret == 0 || m_nret > count)
         m_nret = count;
}

This would be more in line with the tought that each limit call successively limits the output further.

Member

s-ludwig commented Feb 6, 2014

Looks good, except the zero case, which I would rather handle like this:

if (count > 0) {
    if (m_nret == 0 || m_nret > count)
         m_nret = count;
}

This would be more in line with the tought that each limit call successively limits the output further.

@nazriel

This comment has been minimized.

Show comment
Hide comment
@nazriel

nazriel Feb 6, 2014

Contributor

@s-ludwig updated. Hope I got it correctly this time 👻

Contributor

nazriel commented Feb 6, 2014

@s-ludwig updated. Hope I got it correctly this time 👻

@s-ludwig

This comment has been minimized.

Show comment
Hide comment
@s-ludwig

s-ludwig Feb 6, 2014

Member

Thanks a lot! Merging now.

Member

s-ludwig commented Feb 6, 2014

Thanks a lot! Merging now.

s-ludwig added a commit that referenced this pull request Feb 6, 2014

Merge pull request #499 from nazriel/mongodb_limit
Implement limit method for MongoDB driver

@s-ludwig s-ludwig merged commit 26fd18f into vibe-d:master Feb 6, 2014

1 check passed

default The Travis CI build passed
Details

s-ludwig added a commit that referenced this pull request Feb 6, 2014

@s-ludwig

This comment has been minimized.

Show comment
Hide comment
@s-ludwig

s-ludwig Feb 6, 2014

Member

Just discovered that m_limit was still handled differently. But now everything should be good.

Member

s-ludwig commented Feb 6, 2014

Just discovered that m_limit was still handled differently. But now everything should be good.

@nazriel

This comment has been minimized.

Show comment
Hide comment
@nazriel

nazriel Feb 6, 2014

Contributor

Yeah I left limit(0) case as "limit-reset" option.
But I think your approach is more consistant so yeah looks great now!

Contributor

nazriel commented Feb 6, 2014

Yeah I left limit(0) case as "limit-reset" option.
But I think your approach is more consistant so yeah looks great now!

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