Using 'sort' with fh.db API

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Using 'sort' with fh.db API

David Martin
Picked this up on slack, but thought others might find it useful (Thanks Evan, Philip & Chad)

An example of how to sort fh.db results:


    var options = {
        "act": "list",
        "type": collectionName,
        "sort" : {lastName: 1}  // sort JSON results by lastName (ascending).  Use -1 for descending
      };


Probably something worth adding to the docs, so i added https://issues.jboss.org/browse/FH-2894

Evan mentioned that "this might only work if you've upgraded the db since it appears to follow the mongodb syntax/format"
Has anyone tried it without an 'upgraded' db?

--
David Martin
Red Hat Mobile
Twitter: @irldavem
IRC: @irldavem (feedhenry, mobile-internal)

_______________________________________________
feedhenry-dev mailing list
[hidden email]
https://www.redhat.com/mailman/listinfo/feedhenry-dev
Reply | Threaded
Open this post in threaded view
|

Re: Using 'sort' with fh.db API

Wojciech Trocki
Thanks for posting that. Sorting works fine in DataBrowser without database migration. 
Additionally we would need to describe limitations of the query api (impossible to do logical operations etc.)
Adding this info to the ticket.

On Tue, Nov 22, 2016 at 2:55 PM, David Martin <[hidden email]> wrote:
Picked this up on slack, but thought others might find it useful (Thanks Evan, Philip & Chad)

An example of how to sort fh.db results:


    var options = {
        "act": "list",
        "type": collectionName,
        "sort" : {lastName: 1}  // sort JSON results by lastName (ascending).  Use -1 for descending
      };


Probably something worth adding to the docs, so i added https://issues.jboss.org/browse/FH-2894

Evan mentioned that "this might only work if you've upgraded the db since it appears to follow the mongodb syntax/format"
Has anyone tried it without an 'upgraded' db?

--
David Martin
Red Hat Mobile
Twitter: @irldavem
IRC: @irldavem (feedhenry, mobile-internal)

_______________________________________________
feedhenry-dev mailing list
[hidden email]
https://www.redhat.com/mailman/listinfo/feedhenry-dev




--
Wojciech Trocki
Software Engineer, Red Hat Mobile


_______________________________________________
feedhenry-dev mailing list
[hidden email]
https://www.redhat.com/mailman/listinfo/feedhenry-dev