2015-07-10 38 views
1

我使用documentDB我的数据库存储,今天我试图by子句编写一个查询与订单,查询是这样的DocumentDb为了通过返回错误

select * from root r where r.gender = 'Male' ORDER BY r.age 

它返回一个错误,

{"Message: {\"Errors\":[\"Order-by index path has a precision that might result in partially ordered results. To proceed with query execution, specify the enable low precision order by option in the request.\"]}\r\nActivityId: 73dc7fda-659e-4580-b000-2ca5124a44e6, Request URI: /apps/64ca7410-c445-4884-a8bb-32f6a60a6ca2/services/3dd6c9e7-3138-4968-b8e6-be51b4d9748e/partitions/30c57c8f-3494-419b-9f45-ec50582bffd9/replicas/130802821685931221p"} 

然而,如果没有ORDER BY子句执行罚款和正确造成的查询,

什么错我的查询?

任何帮助将是非常可观的。

在此先感谢。

+1

按照我们得到的年龄列可能是类型float或double的错误它是说索引路径有一个精度,所以在你的顺序中通过条款 –

+0

循环可能是问题不是与dataType,当我尝试给名称的顺序也发生同样的错误。 –

回答

2

您应该修改索引策略以使用Maximum precision(-1)以执行Order By。请参考https://azure.microsoft.com/en-us/documentation/articles/documentdb-orderby/#configure-an-indexing-policy-for-order-by

+0

我可以修改已存在集合的索引策略吗?或需要使用此索引策略创建新集合?我在每个集合中都有超过20K条记录。我不想丢失数据。 –

+0

目前不支持。您可以在这里查看功能可用性的更改:http://feedback.azure.com/forums/263030-documentdb/suggestions/8749198-dynamic-indexing-policies –