title: how do i redirect in express with a given ID?
body: <p>This code makes my app pick a random document from my mongoDB </p>
  
  <pre><code>router.get("/random", (req, res) =&gt; {
    try {
      postModel.countDocuments().exec(function(err, count) {
        var random = Math.floor(Math.random() * count);
        postModel
          .findOne()
          .skip(random)
          .exec(function(err, randomPost) {
            console.log(randomPost);
            res.render("play", { randomPost });
          });
      });
    } catch (err) {
      res.json({ msg: err });
    }
  });
  </code></pre>
  
  <p>I have an ejs template which is named play.ejs, and it renders the file succesfully with the random chosen document.</p>
  
  <p>But I want it to have a URL like /play/"idOfRandomChosenDocument" instead of /random everytime. How do I do this?
  Do I need to create <code>router.get("/play/:postid")</code> and if so, how do I pass in the id of the random document and it successfully loading with the right document objects?</p>