We have a collection with ItemId/DateTime/Location fields.
We are tracking Items and their Locations (like, Storage1 or Building2 or City3. etc.) in time, Item might change its Location several times per day, or may not change a Location for a week.
Now I want to know, where all my Items were at a certain point in time.
Basically, I want to get the latest entry for each Item with DateTime < N.
What is the best way to query/model that in RavenDB?
If it makes things simpler, it's ok to query by Date only (i.e. without time), but simple grouping on ItemId-Date will not work, since there might be no entries for a certain Item on certain date.
The question is similar to another one, but there the goal is to get the latest data for a single item, while I want to get the 'latest' data for all items.