简体   繁体   English

IDocumentQuery中documentdb linq查询中的OrderBy

[英]OrderBy in documentdb linq query in IDocumentQuery

I try to use OrderBy in IDocumentQuery query under documentdb in c#. 我尝试在c#中documentdb下的IDocumentQuery查询中使用OrderBy I try to retrieve list of courses order by distance from my place so: 我尝试按距我的位置的距离来检索课程顺序列表,因此:

var userQuery = _client
    .CreateDocumentQuery<Course>(_uriCourseCollection, options)
    .Where(x => x.CourseName.ToLower().Contains(text))
    .OrderBy(x =>x.GeoLocation.Location.Distance(myPoint))
    .AsDocumentQuery();

I received the following error message : 我收到以下错误消息:

"Unsupported ORDER BY clause. ORDER BY item expression could not be mapped to a document path" “不受支持的ORDER BY子句。ORDERBY项目表达式无法映射到文档路径”

Someone may have solution ? 有人可以解决吗? , or a workaround to solved the query in efficient way ? ,还是解决问题的有效方法?

"Unsupported ORDER BY clause. ORDER BY item expression could not be mapped to a document path" “不受支持的ORDER BY子句。ORDERBY项目表达式无法映射到文档路径”

According to the Azure official document , ordering results by the ST_DISTANCE spatial function is currently not supported. 根据Azure官方文档 ,当前不支持ST_DISTANCE空间函数的排序结果。 I also find this feedback , you could vote it. 我也可以找到此反馈 ,您可以投票。

Order By queries by default also require maximum index precision (-1). 默认情况下,Order By查询还需要最大索引精度(-1)。 DataType can be String or Number 数据类型可以是字符串数字

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM