In RavenDB
I need to get the latest insert for a document based on it's ID and filter by IDs from a list
ie:
List<Entity> GetLastByIds(List<int> ids);
The Entity is similar to:
class Entity
{
int id; //Unique identifier for the category the price applies to.
int Price; //Changes with time
DateTime Timestamp; //DateTime.UtcNow
}
so if I insert the following:
session.Store(new Entity{Id = 1, Price = 12.5});
session.Store(new Entity{Id = 1, Price = 7.2});
session.Store(new Entity{Id = 1, Price = 10.3});
session.Store(new Entity{Id = 2, Price = 50});
session.Store(new Entity{Id = 3, Price = 34});
...
How can I get the latest price for IDs 1 and 3 ??
I have the Map/Reduce working fine, giving me the latest for each ID, it's the filtering that I am struggling with. I'd like to do the filtering in Raven, because if there are over 1024 price-points in total for all IDs, doing filtering on the client side is useless.
Much appreciate any help I can get.
Thank you very much in advance :)