Assuming you already have access to the collection, you need the find () method:
collection.find(query, options, callback);
You can use the query object to specify conditions and the parameter object to sort. For details on how to build two objects, see the mongodb driver documentation .
So, in your case, for example, something like this example might work. For the mentioned โconditionโ, I use the condition that the โquantityโ field is greater than 0, and then sort by the largest quantity.
collection.find( {quantity: {$gt: 0}}, {sort: {quantity: -1}}, function(err, docs) {
Monk itself is fairly easily documented, but it basically calls mongoskin and then the mongodb native driver, linked above, so the documentation for them is a good place to view it.
source share