title: If condition doesn't trigger in the Express route
body: <p>This is really weird, and I can't understand what I'm doing wrong. I have a checkbox that, when checked, sets <code>searchByName</code> parameter to <code>true</code>in some React component. Then, I'm using <code>axios</code> to <code>.get</code> a route that needs to search and return the list of users. If <code>searchByName</code> is <code>true</code>, then MongoDB is queried by name, and when it's <code>false</code>, it queries by using some other parameters. </p>
  
  <p>The problem is, that when I console <code>searchByName</code> in the route, I see it's value properly (either true or false), however, my condition that checks if it's true or false doesn't trigger, and I'm always getting the results for the <code>true</code> case. I added <code>console.log("Im name")</code> and <code>console.log("Im city")</code> to see whether or not the code triggers, but it's always the <code>name</code> case, even if <code>searchByName</code> is false.</p>
  
  <p>Could you help to figure this out?</p>
  
  <pre><code>// @route   GET api/report/:search/:searchByName
  // @desc    Get users
  // @access  Private
  router.get("/:search/:searchByName", auth, async (req, res) =&gt; {
    if (req.params.searchByName) {
      console.log("im name");
      try {
        const query = req.params.search;
        const reports = await Report.find({
          name: { $regex: query },
          isPublic: true
        })
          .select([
            "name",
            "status",
            "startDate",
            "country",
            "zipcode",
            "city",
            "address"
          ])
          .populate("users", [
            "name",
            "status",
            "startDate",
            "country",
            "zipcode",
            "city",
            "address"
          ]);
  
        res.json(reports);
      } catch (err) {
        console.error(err.message);
        res.json(err);
        res.status(500).send("Server Error");
      }
    } else if (!req.params.searchByName) {
      console.log("im city");
      try {
        const query = req.params.search;
        const reports = await Report.find({
          $or: [{ city: { $regex: query } }, { zipcode: { $regex: query } }]
        })
          .select([
            "status",
            "startDate",
            "country",
            "zipcode",
            "city",
            "address"
          ])
          .populate("users", [
            "status",
            "startDate",
            "country",
            "zipcode",
            "city",
            "address"
          ]);
  
        res.json(reports);
      } catch (err) {
        console.error(err.message);
        res.json(err);
        res.status(500).send("Server Error");
      }
    }
  });
  </code></pre>