Uploaded image for project: 'Couchbase Documentation'
  1. Couchbase Documentation
  2. DOC-1029

selection and grouping/reduce ordering

    XMLWordPrintable

Details

    Description

      The documentation says that the selection (for instance function key) is applied after the reduce function. Why do I get the following results ?

      If I have the documents :

      { "k1": 1, "k2": 1 } { "k1": 1, "k2": 2 }

      and the map is : emit([doc.k1, doc.k2], null)

      and the reduce is: _count

      why do I get the following results ?
      query.group_level(1).key(1) = 0 // expected 2
      query.group_level(1).key([1,1]) = 1 // expected 0

      It seems that key is applied before the grouping/reduce function. If you execute query.group_level(1), you got a single result :
      [1] => 2

      If you add .key(xxx), the data set of the views seems to be filtered to match only the key xxx.
      if xxx=1, there is no result because there is no row in the view with the key 1.
      if xxx=[1,1] there is a single result because there is a single row with the key [1,1]

      Is there something wrong in my tests ?

      Attachments

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

        Activity

          People

            amarantha.kulkarni Amarantha Kulkarni (Inactive)
            cecile.lepape Cecile Le Pape
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty