Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.0.0
    • Fix Version/s: None
    • Component/s: library
    • Security Level: Public
    • Labels:
      None

      Description

      I'm creating this ticket on behalf of a user who is not able to login here.

      He's able to create and load a view from the UI like so:

      View name is „_design/statistics/_view/class_malware“

      Map is:
      function (doc, meta) {

      if (doc.malware == null)

      { emit("buggy",1) }

      else if (doc.malware == true)

      { emit("malware",1); }

      else

      { emit("clean",1); }

      }

      Reduce ist:
      _count

      Via the URL (/<bucket>/_design/statistics/_view/class_malware?stale=update_after&connection_timeout=60000&limit=10&skip=0&group_level=1) I’ll get the correct result:

      {"rows":[

      {"key":"clean","value":1}

      ,

      {"key":"malware","value":95}

      ]
      }

      Now, when he uses it from the python sdk like this:

      print self.__CB.conn.query('/statistics', 'class_malware')
      or
      print self.__CB.conn.query('statistics', 'class_malware', group_level=1, reduce=True)

      He always gets

      View<Design=statistics, View=class_malware, Query=Query:'', Rows Fetched=0>

      .. when reduce is disabled, also no rows fetched.

      If its wrong usage, or incomplete information let me know and I'll work it through with him.Thanks!

      No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

        Hide
        mnunberg Mark Nunberg added a comment -

        He needs to iterate over the returned object -

        Show
        mnunberg Mark Nunberg added a comment - He needs to iterate over the returned object -
        Hide
        mnunberg Mark Nunberg added a comment -

        I should probably make this clearer in the '_repr_' output though..

        Show
        mnunberg Mark Nunberg added a comment - I should probably make this clearer in the '_ repr _' output though..
        Hide
        Torsten Feld Torsten Feld added a comment -

        Hi Mark,

        I can confirm that. With iterating over the returned object, it's working. I was just irritated, that I got 0 rows. I think it would be nice to have the number of rows returned 'correctly'. With that information (in my case 2 rows) I'd have known, that i have to do something with the result.

        But thank you for pointing that out

        @Michael: thanks for opening this ticket.

        Best regards,
        Torsten

        Show
        Torsten Feld Torsten Feld added a comment - Hi Mark, I can confirm that. With iterating over the returned object, it's working. I was just irritated, that I got 0 rows. I think it would be nice to have the number of rows returned 'correctly'. With that information (in my case 2 rows) I'd have known, that i have to do something with the result. But thank you for pointing that out @Michael: thanks for opening this ticket. Best regards, Torsten
        Hide
        mnunberg Mark Nunberg added a comment -

        The View object when first created does not actually connect to the network yet. It only begins iterating once - so no rows have been returned yet.

        Show
        mnunberg Mark Nunberg added a comment - The View object when first created does not actually connect to the network yet. It only begins iterating once - so no rows have been returned yet.

          People

          • Assignee:
            mnunberg Mark Nunberg
            Reporter:
            daschl Michael Nitschinger
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Gerrit Reviews

              There are no open Gerrit changes