I have a collection in mongo which has name and count fields.
{name:\'myName\',count:5}
Is it possible to sort data by count and export as json
Starting with MongoDB 2.6, you can pass --sort to mongoexport directly:
--sort
mongoexport --db mydatabase -c people --fields name,age --sort "{name: 1, age: 1}"