diff options
Diffstat (limited to 'server/models')
-rw-r--r-- | server/models/videos.js | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/server/models/videos.js b/server/models/videos.js index eaea35b7f..aa9ed687d 100644 --- a/server/models/videos.js +++ b/server/models/videos.js | |||
@@ -76,8 +76,8 @@ function get (id, callback) { | |||
76 | }) | 76 | }) |
77 | } | 77 | } |
78 | 78 | ||
79 | function list (callback) { | 79 | function list (start, count, callback) { |
80 | VideosDB.find(function (err, videosList) { | 80 | VideosDB.find({}).skip(start).limit(start + count).exec(function (err, videosList) { |
81 | if (err) { | 81 | if (err) { |
82 | logger.error('Cannot get the list of the videos.') | 82 | logger.error('Cannot get the list of the videos.') |
83 | return callback(err) | 83 | return callback(err) |
@@ -125,8 +125,9 @@ function removeByIds (ids, callback) { | |||
125 | VideosDB.remove({ _id: { $in: ids } }, callback) | 125 | VideosDB.remove({ _id: { $in: ids } }, callback) |
126 | } | 126 | } |
127 | 127 | ||
128 | function search (name, callback) { | 128 | function search (name, start, count, callback) { |
129 | VideosDB.find({ name: new RegExp(name) }, function (err, videos) { | 129 | VideosDB.find({ name: new RegExp(name) }).skip(start).limit(start + count) |
130 | .exec(function (err, videos) { | ||
130 | if (err) { | 131 | if (err) { |
131 | logger.error('Cannot search the videos.') | 132 | logger.error('Cannot search the videos.') |
132 | return callback(err) | 133 | return callback(err) |