Skip to content
This repository was archived by the owner on Sep 8, 2025. It is now read-only.
This repository was archived by the owner on Sep 8, 2025. It is now read-only.

iterview does not work for views on which you specify reduce in the options. #270

Open

Description

@mountainpaul

So since your doing a reduce there is no "id" value, and it will throw an exception. It would be nice to fix this, but I think you would have to do a skip.

Activity

  1. changed the title [-]iterview does not work for views on which you specify reduce.[/-] [+]iterview does not work for views on which you specify reduce in the options.[/+] on Jan 1, 2016
  2. djc commented on Jan 4, 2016

    @djc
    Owner

    Hmm, it feels like it might work with startkey, but without startkey_docid. Perhaps you can give that a whirl? The iterview() code could only pass startkey_docid if reduce is not specified, or even when id is not available on the resutl.

  3. mountainpaul commented on Mar 18, 2016

    @mountainpaul
    Author

    Specifying a startkey does not appear to help. It appears for the first batch that 'id' is available, but on the second batch (i.e. next iteration) the id is not available.

  4. mountainpaul commented on Mar 18, 2016

    @mountainpaul
    Author

    Changing client.py at line 870 from

               options.update(startkey=rows[-1]['key'], startkey_docid=rows[-1]['id'])
    to 
               try:
                    options.update(startkey=rows[-1]['key'], startkey_docid=rows[-1]['id'])
               except KeyError: 
                    if rows[-1]['key']!=rows[-2]['key']:
                          options.update(startkey=rows[-1]['key'])
                    else:
                          raise

    fixed my issue, but in my specific case the key was unique because of the group level.

  5. nedgar commented on Oct 13, 2016

    @nedgar

    When doing a reduce, isn't each key unique, even for different group levels? Seems like it should be feasible to just omit the startkey_docid when reduce is True. I'm trying this out now.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions