Update README.md

pull/2/head
Louis Chatriot 11 years ago
parent 305dc2776a
commit d126f0a44d
  1. 8
      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) { db.find({}).sort({ planet: 1 }).skip(1).limit(2).exec(function (err, docs) {
// docs is [doc3, doc1] // 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!
``` ```

Loading…
Cancel
Save