Sorting of records gives irreverent results I am using mongoDB with sails.js
Here is the syntax:
 model.find(conditions).sort({ "title": -1 }) 
Sorting of records gives irreverent results I am using mongoDB with sails.js
Here is the syntax:
 model.find(conditions).sort({ "title": -1 }) 
 
    
    Sails supports native MongoDB queries so yo can use MongoDB Aggregation framework.
model.native(function(err, collection) {
    collection.aggregate(
        //...
    );
});
Take a look here http://docs.mongodb.org/manual/applications/aggregation/
 
    
    Use can use the lodash global to perform the sort instead, like this:
model.find(conditions).exec(function(err, records) {
    _.sortBy(records, function(blah){ return your_custom_logic_here; });
});
