From bb10240ee15d31a1cc17c0e3d748dde817e7d0cb Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 13 May 2016 20:42:11 +0200 Subject: Add createdDate to videos --- server/models/videos.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'server/models') diff --git a/server/models/videos.js b/server/models/videos.js index aa9ed687d..250ad3952 100644 --- a/server/models/videos.js +++ b/server/models/videos.js @@ -19,7 +19,11 @@ const videosSchema = mongoose.Schema({ podUrl: String, author: String, duration: Number, - thumbnail: String + thumbnail: String, + createdDate: { + type: Date, + default: Date.now + } }) const VideosDB = mongoose.model('videos', videosSchema) @@ -46,13 +50,13 @@ function add (video, callback) { const params = video params.podUrl = http + '://' + host + ':' + port - VideosDB.create(params, function (err, video) { + VideosDB.create(params, function (err, insertedVideo) { if (err) { logger.error('Cannot insert this video into database.') return callback(err) } - callback(null) + callback(null, insertedVideo) }) } -- cgit v1.2.3