I need to query on a collection to get the 5 most expensive elements on client side I have written the following:
var topDescending=Products.find({Active:1},{sort:{Cost:-1}},{limit:5} ).fetch()
But cannot get what I want.
This significant collection has been published from server side and subscribed from client side with no limit since in other cases on client side I need to access the collection without limit. So I don’t believe that limiting on publish/subscribe is what I need.
The above is written in order to further be set in a Session variable, it is not included in a helper.
I added this line after fetching
var topFive=topDescending.slice(0,5)
But is there any other better way for the limit to work straight forward?