Order by ID in RavenDB

心不动则不痛 提交于 2019-12-22 08:55:26

问题


Is there a way to have Raven order the results of a query by the Id field as if it was in integer. So "cars/2" would come before "cars/11" if I did this query:

var cars = session.Query<Car>().OrderBy(c => c.ID);

回答1:


You shouldn't rely on the id of the document to be sortable in any way. Add a CreatedAt property or something similar and use that



来源:https://stackoverflow.com/questions/6144898/order-by-id-in-ravendb

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!