This works, but once I change the 123 to req.params.userId, I obtain an empty array from the GET request. 
router.get("/:userId", async (req, res) => {
  const posts = await loadPostCollection();
  console.log(req.params.userId) //>>>123
  const info = await posts
    .find({
      userInfo: {
        userId: 123, //req.params.userId doesn't work
        notes: []
      }
    })
    .toArray();
  res.send(await info);
});
edit: the question was not how to convert string to num or num to string, but rather help with finding out what's wrong with the code. Therefore, not duplicate.
 
    