Order by ID in RavenDB

Is there a way to get Raven to order the results of the query by the Id field as if it were integer. So "cars / 2" will arrive earlier than "cars / 11" if I make this request:

var cars = session.Query<Car>().OrderBy(c => c.ID); 
+4
source share
1 answer

You should not rely on a document identifier that can be sorted in any way. Add a CreatedAt property or something similar and use this

+8
source

All Articles