title: Mongoose: how to set a query that $in everything if there is no value selected?
body: <p>I am trying to apply the filter to my aggregate search right now. Currently, I can't set the value <code>$in:</code> to include everything.</p>
  <pre><code>if (gameType.length === 0) {
      query = {
        gameCode: {
          $in: gameCode,
        },
     
      };
    } else {
      query = {
        gameType: {
          $in: gameType,
        },
        gameCode: {
          $in: gameCode,
        },
      };
    }
  </code></pre>
  <p>The above code is what I have. Users can select more than one <code>gameType</code>. Because, I don't know how to set <code>$in</code> to include everything, I have used the <code>if statement</code> to exclude <code>gameType</code> from the query when user has not selected any = returning all the <code>gameType</code>.</p>
  <p>Is there any way that I can set a variable to search every <code>gameType</code> besides providing the array with all the values (I will probably do that if there is no way that I can do this)?</p>