Hi, Shiv: Does a range index exist on the JSON property? That's necessary to sort on a property.
Erik Hennum ________________________________ From: general-boun...@developer.marklogic.com [general-boun...@developer.marklogic.com] on behalf of Shiv Shankar [shiv.shivshan...@gmail.com] Sent: Wednesday, January 04, 2017 11:03 AM To: MarkLogic Developer Discussion Subject: Re: [MarkLogic Dev General] sort-order is not working with REST Thanks Eric, With this change, I could get the data, but no order change though the sort-order specified ascending/descending. Lets say firstName is "abc", "xyz", the query returning the response in the same order irrespective of sort-order. Am I missing anything? Regards Shan. On Wed, Jan 4, 2017 at 12:05 PM, Shiv Shankar <shiv.shivshan...@gmail.com<mailto:shiv.shivshan...@gmail.com>> wrote: Hi, I am trying to use sort-order in $query. It is returning 0 records. All my documents are JSON. Any inputs? {"$query":{"options":{"sort-order":[{"direction":"descending","element":{"name":"firstName","score": null}}]}}} Tried with {"$query":{"options":{"sort-order":[{"direction":"descending","json-property":"firstName"}]}}} Note: I created Index on that field too. Regards Shan.
_______________________________________________ General mailing list General@developer.marklogic.com Manage your subscription at: http://developer.marklogic.com/mailman/listinfo/general