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

Obtaining latest versions, and similar aggregation patterns

    XMLWordPrintable

Details

    Description

      We have seen this pattern in customer POCs and online:

      Select all documents that are represent the latest revision for a user or some other key, or the latest arrival time, or some other aggregate. The solution pattern is:

      • GROUP BY the keys
      • wrap an aggregation function, e.g. MAX, MIN, around an array pair containing 2 items: the comparison expression and the document reference.

      See this stack overflow for an example of both the question and the solution: http://stackoverflow.com/questions/34117559/obtaining-last-revisions-in-couchbase-with-n1ql/34122200#34122200

      Attachments

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

        Activity

          People

            simon.dew Simon Dew
            gerald Gerald Sangudi (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty