title: Meteor.js – $or mongodb query based on Session variables
body: <p>I'm building a page on a meteor site that lists the documents of a collection. The collection is stored in a variable called Tools and has a field named "categories". At the top of this page, I want to have buttons that correspond to the categories; when the button is active, the documents of that category show up. When a button is not active, the documents of that category do not show up.</p>
  
  <p>The thing that's throwing me is that I want to set it up so that you can select multiple categories at once.</p>
  
  <p>To hard code the mongodb query to return multiple category would be something like:</p>
  
  <pre><code>Tools.find(
    { $or: 
      [
        { category: 'tech' },
        { category: 'creative' } 
      ] 
    }
  );
  </code></pre>
  
  <p><strong>But I can't figure out how to write this query such that it updates according to Session variables.</strong></p>
  
  <p>As for the Session variables themselves, would it be better to have a boolean variable for each category? As in...</p>
  
  <pre><code>Session.set('tech', true);
  Session.set('creative', false);
  //etc...
  </code></pre>
  
  <p>Or would it be better to store them in an array? As in...</p>
  
  <pre><code>Session.set('categories', ['tech', 'creative']);
  </code></pre>
  
  <p>Thanks in advance!</p>