azure - Azure cosmos db 别名列 order by
问题描述
我在 cosmos db 中编写了一个运行良好的选择查询。但是在那个查询中,当我尝试在别名列上按列添加顺序时,它不起作用。这里的距离是一个别名列 正确的方法是什么?
SELECT c.id,c.type,c.name,c.latitude,c.longitude,c.location, ST_Distance(c.location, { 'type': 'Point', 'coordinates':[-112.215641, 33.181647]}) as distance FROM c WHERE ST_Distance(c.location, { 'type': 'Point', 'coordinates':[-112.215641, 33.181647]}) < 321868.8 ORDER BY c.distance ASC
解决方案
Actually,we are told that we can only sort with properties of document, not derived values. Please see this link.You distance
column is derived value,can't be used at order by
.
“Unsupported ORDER BY clause. ORDER BY item expression could not be mapped to a document path”</p>
I would suggest you sort the query result by yourself.For example,in .net code,you could use Sort function to sort the result by the column.
推荐阅读
- javascript - 如何在不使用位置属性的情况下重叠表格(td)文本
- wordpress - 带有请求批准表和用户页面上的批准检查的 Wordpress 插件
- r - 使用 dplyr 的多个 group_by
- haskell - 使用 -hy 进行 GHC 堆分析 - 什么是 ->、->>、->>>?
- html - 锚标签上“rel”属性的默认值是多少?
- google-apps-script - 来自 Google Apps 脚本的 Google 日历中的第三方会议
- c# - C# SHA256 RSA 签名。如何从 byte[] 符号中获取字符串?
- laravel - 测试 RESTful 控制器更新方法时使用 Laravel Passport 授权用户
- c# - 如何检测每次在上下文菜单(winforms)上按下一个键?
- ansible - 从循环中跳过项目