diff options
author | Simon Bartlett <simon@securitycompass.com> | 2015-02-05 10:04:01 -0500 |
---|---|---|
committer | Simon Bartlett <simon@securitycompass.com> | 2015-02-05 10:04:01 -0500 |
commit | d5d1bc015774190b1c7ae3d0a8d560fd600bac38 (patch) | |
tree | c16820184a22bc1f8b8f0267a46a02b3fe949402 /app/core/files.js | |
parent | 85071f30b6bd3f3f085ec26c5b862e74094335a9 (diff) | |
download | lets-chat-d5d1bc015774190b1c7ae3d0a8d560fd600bac38.zip lets-chat-d5d1bc015774190b1c7ae3d0a8d560fd600bac38.tar.gz lets-chat-d5d1bc015774190b1c7ae3d0a8d560fd600bac38.tar.bz2 |
Transcript update
Diffstat (limited to 'app/core/files.js')
-rw-r--r-- | app/core/files.js | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/app/core/files.js b/app/core/files.js index d7b4bae..3be62ab 100644 --- a/app/core/files.js +++ b/app/core/files.js @@ -98,9 +98,15 @@ FileManager.prototype.list = function(options, cb) { find.skip(options.skip); } + if (options.sort) { + var sort = options.sort.replace(',', ' '); + find.sort(sort); + } else { + find.sort({ 'uploaded': -1 }); + } + find .limit(options.limit || 500) - .sort({ 'uploaded': -1 }) .exec(function(err, files) { if (err) { console.error(err); |