Monday, 13 March 2017

Node JS best way to order the results of a query

I'm developing a simple Node js express application. I have a collection of object saved on MongoDB and I want to show them in my home page. I would like to allow the users to order the elements in the page.

At the moment, every time the user change the order, I send a request to the server with a parameter (order='..') that allows to sort the list of element in MongoDB and then the server return the ordered data to the client.

I don't really like this approach. Is there something better or this is the best way to change a query results showing order?



via Giacomo Resci

No comments:

Post a Comment