From d126f0a44d302d06ebb0e42ccca360cbd34604ec Mon Sep 17 00:00:00 2001 From: Louis Chatriot Date: Sun, 26 Jan 2014 13:56:31 +0100 Subject: [PATCH] Update README.md --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.md b/README.md index 237aeaf..f08d5a5 100644 --- a/README.md +++ b/README.md @@ -315,6 +315,14 @@ If you don't specify a callback to `find`, `findOne` or `skip`, a `Cursor` objec db.find({}).sort({ planet: 1 }).skip(1).limit(2).exec(function (err, docs) { // docs is [doc3, doc1] }); + +// You can sort in reverse order like this +db.find({ system: 'solar' }).sort({ planet: -1 }).exec(function (err, docs) { + // docs is [doc1, doc3, doc2] +}); + +// You can sort on one field, then another, and so on like this: +db.find({}).sort({ firstField: 1, secondField: -1 }) ... // You understand how this works! ```