eventsourcing/es4j

Problem: Min/Max queries are global to the attribute

Open

#209 opened on Jan 27, 2017

View on GitHub
 (0 comments) (0 reactions) (0 assignees)Java (27 forks)batch import
enhancementhelp wanted

Repository metrics

Stars
 (406 stars)
PR merge metrics
 (No merged PRs in 30d)

Description

At this moment, Min/Max queries are limited to finding the smallest or largest value of a particular attribute globally across an entity. Which means you can tell "what's the latest order" but not "what's the latest order for this person". IsLatestEntity/LatestAssociatedEntryQuery are currently being used to address this type of need, but they are very slow and cumbersome. Min/Max has been already optimized for PostgreSQL storage.

It would have been great if it was possible to fit this type query within Min/Max as an option:

// Find the last order for user with id=<id>
max(Order.TIMESTAMP, equal(Order.USER_ID, id))
// Find all last orders for all users
max(Order.TIMESTAMP, Order.USER_ID)

(Or something similar)

Contributor guide