2015-07-10 42 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 –

相關問題