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

Update 2014-04-14-pagination-strategies-with-pouchdb.md #6634

Merged
merged 1 commit into from
Jul 22, 2017

Conversation

mikeymckay
Copy link
Contributor

@mikeymckay mikeymckay commented Jul 20, 2017

I was having trouble getting the "smart method" to work. I was confused about why you would create a startkey that contains the entire row, instead of just the id for the doc. I finally figured it out. If include_docs = false, then having a startkey like this:

{ id: 'Client Demographics',
key: 'Client Demographics',
value: { rev: '569-5a192c494eca04611bc046a50a5283de' } }

seems to work (seems like a bug/side-effect, but it works). However, when you use include_docs=true it also has a doc property, and passing this object doesn't work as a valid startkey.

The solution, which works in both include_docs=true and include_docs=false, and which seems to make much more sense to me, is to only use the id of the doc for the startkey. That's what my pull request does.

I was having trouble getting the "smart method" to work. I was confused about why you would create a startkey that contains the entire row, instead of just the id for the doc. I finally figure it out. If include_docs = false, then having a startkey like this:

{ id: 'Client Demographics',
  key: 'Client Demographics',
  value: { rev: '569-5a192c494eca04611bc046a50a5283de' } }

seems to work (seems like a bug/side-effect, but it works). However, when you use include_docs=true it also has a doc property, and passing this object doesn't work as a valid startkey.

The solution, which works in both include_docs=true and include_docs=false, and which seems to make much more sense to me, is to only use the id of the doc for the startkey. That's what my pull request does.
Copy link
Member

@daleharvey daleharvey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like a good catch to me, thanks

@daleharvey daleharvey merged commit 8a2316c into pouchdb:master Jul 22, 2017
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

Successfully merging this pull request may close these issues.

None yet

2 participants