Details
-
Improvement
-
Resolution: Won't Fix
-
Major
-
4.0
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