Filtering mongoose data on the clientside with EJS based on a dropdown selection Filtering mongoose data on the clientside with EJS based on a dropdown selection mongoose mongoose

Filtering mongoose data on the clientside with EJS based on a dropdown selection


I would advise you use optgroup, just to have to have your code simple and your data concentrated.

<select id="catDropdown" class="ui fluid dropdown">   <option value="">Category</option>   <% cats.forEach(category => { %>   <optgroup label="<%= category.name %>" >       <% category.products.forEach(product => { %>           <option> <%= product.name %> </option>       <% }); %>   </optgroup>   <% }); %></select>