Order Query Results with Azure DocumentDB

Publisert på 7 juli, 2015

Program Manager, Azure DocumentDB
Today, we're pleased to announce a key improvement in SQL querying - DocumentDB now supports Order By, and string range queries! With this change, you will be able to sort query results using any string, numeric, or Boolean property in your JSON documents. DocumentDB's Order By can be used to serve low latency queries against massive collections of documents and is designed to work with a minimal index storage overhead. Azure DocumentDB is a fully managed NoSQL document database service designed to store and retrieve automatically indexed JSON data. DocumentDB’s automatic indexing and SQL query capabilities allow you to rapidly build and iterate on application experiences. Order By is now enabled on all existing and new DocumentDB accounts. You can try Order By right now at the DocumentDB query playground, Azure Preview Portal, or read through the documentation here. Using the .NET SDK version 1.2.0 and higher, you can also use the OrderBy() or OrderByDescending() clause within LINQ queries. Order by-03   In order to use Order By or range comparisons within your queries, you must specify an index policy that contains a Range index with the maximum precision over the JSON properties used to sort with. You can do this through the Azure Preview Portal while creating new collections, or programmatically using the new SDK releases and/or REST API. To support string range queries and sorting on strings, we have updated the DocumentDB APIs with support for specifying range indexes on strings when creating new collections. For more details, refer to the documentation on indexing policies here. Note that indexing policies for collections must be configured at collection creation time. We have started work on the functionality to modify the indexing policy of existing collections after e.g., adding/removing paths or switching between Hash and Range indexing. Get started with Order By by downloading version 1.2.0 of the .NET SDK from Nuget here. We have also created a Github project containing code samples for common usage patterns in .NET. If you need any help, please reach out to us on the Azure DocumentDB Developer Forums on MSDN, developer forums on stack overflow, or schedule a 1:1 chat with the DocumentDB engineering team. To stay up to date on the latest DocumentDB news and features, follow us on Twitter: