I have this code:
router.get("/index/fill", function(req, res){
  var topicId = req.query.topicId;
  Topics.findById(topicId, function(err, topic){
    if(err){
      console.log(err);
    } else {
      var random = Math.floor(Math.random() * 115)
      Playlist.find({$or: [{title: new RegExp(topic.title, 'i')}]}).sort({date: -1}).limit(1).skip(random).exec(function(err, recentPlaylists){
        if(err){
          console.log(err);
        } else {
        }
      }); 
    }
  });
});
I found out that .skip() is not working, when I use the code without .skip() part it works.
I followed this post to write the code.
When i use .skip() it returns a empty array.
What am I doing wrong with the .skip() and how can I fix this?
 
    