Sorting timestamp in descending order in mongodb

mongodb, node.js

Solution

Product.find({
        userId: data.id
    },null,{ sort :{ createdOn : -1}},function(err, products) {...});

I only have to remove $ from $sort it works fine for me now :)

Problem

``` Product.find({ userId: data.id },null,{ $sort :{ createdOn : -1}},function(err, products) {...}); ``` I want to sort createdOn in desc order and am not getting the desire result note: createdOn is a timestamp and Iam using mongodb 1.3.19 please help!!

Original source